public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonCodeDeployConfig config = new AmazonCodeDeployConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonCodeDeployClient client = new AmazonCodeDeployClient(creds, config); ListDeploymentsResponse resp = new ListDeploymentsResponse(); do { ListDeploymentsRequest req = new ListDeploymentsRequest { NextToken = resp.NextToken }; resp = client.ListDeployments(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Deployments) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
protected override void ProcessRecord() { base.ProcessRecord(); ListDeploymentsRequest request; try { request = new ListDeploymentsRequest { CompartmentId = CompartmentId, GatewayId = GatewayId, DisplayName = DisplayName, LifecycleState = LifecycleState, Limit = Limit, Page = Page, SortOrder = SortOrder, SortBy = SortBy, OpcRequestId = OpcRequestId }; IEnumerable <ListDeploymentsResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.DeploymentCollection, true); } FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Returns a list of deployments. /// /// </summary> /// <param name="request">The request object containing the details to send. Required.</param> /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param> /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param> /// <returns>A response object containing details about the completed operation</returns> public async Task <ListDeploymentsResponse> ListDeployments(ListDeploymentsRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called listDeployments"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/deployments".Trim('/'))); HttpMethod method = new HttpMethod("Get"); HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request); requestMessage.Headers.Add("Accept", "application/json"); GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration); HttpResponseMessage responseMessage; try { if (retryingClient != null) { responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken); } else { responseMessage = await this.restClient.HttpSend(requestMessage); } return(Converter.FromHttpResponseMessage <ListDeploymentsResponse>(responseMessage)); } catch (Exception e) { logger.Error($"ListDeployments failed with error: {e.Message}"); throw; } }
public async Task <string> GetLoginToken(string pit) { var listDeploymentsRequest = new ListDeploymentsRequest { ProjectName = ProjectName, Filters = { new Filter { TagsPropertyFilter = new TagsPropertyFilter { Tag = DeploymentTagFilter, Operator = TagsPropertyFilter.Types.Operator.Equal, }, } } }; var suitableDeployment = deploymentServiceClient.ListDeployments(listDeploymentsRequest).First(); var loginRequest = new CreateLoginTokenRequest { PlayerIdentityToken = pit, DeploymentId = suitableDeployment.Id, LifetimeDuration = Duration.FromTimeSpan(new TimeSpan(0, 0, 15, 0)), WorkerType = "UnityClient" }; var createLoginTokenResponse = await playerAuthServiceClient.CreateLoginTokenAsync(loginRequest); return(createLoginTokenResponse.LoginToken); }
protected override void ProcessRecord() { base.ProcessRecord(); ListDeploymentsRequest request; try { request = new ListDeploymentsRequest { CompartmentId = CompartmentId, LifecycleState = LifecycleState, DisplayName = DisplayName, Limit = Limit, Page = Page, SortOrder = SortOrder, SortBy = SortBy, OpcRequestId = OpcRequestId }; IEnumerable <ListDeploymentsResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.DeploymentCollection, true); } if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null) { WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources."); } FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// A pageable sequence of <see cref="Deployment"/> resources. /// </returns> public override gax::PagedEnumerable <ListDeploymentsResponse, Deployment> ListDeployments( ListDeploymentsRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_ListDeploymentsRequest(ref request, ref callSettings); return(new gaxgrpc::GrpcPagedEnumerable <ListDeploymentsRequest, ListDeploymentsResponse, Deployment>(_callListDeployments, request, callSettings)); }
public static List <Deployment> ListDeployments(ListDeploymentsRequest request) { return(ExceptionHandler.HandleGrpcCall(() => { var response = deploymentServiceClient.ListDeployments(request); return response.ToList(); })); }
public async Task <IActionResult> List([FromQuery] int skip = 0, [FromQuery] int take = 20) { var request = new ListDeploymentsRequest(skip, take); var response = await _mediator.Send(request); var envelope = new EnumerableEnvelope <DeploymentDto>(response); return(Ok(envelope)); }
static void Main(string[] args) { Console.WriteLine("GO and check!"); Dictionary <string, string[]> resultMap = readCustomerProjectInfo(); foreach (KeyValuePair <string, string[]> entry in resultMap) { Boolean isWorkflagUsed = false; var customer_name = entry.Key; string[] projectNames = entry.Value; Console.WriteLine(customer_name); for (int i = 1; i < projectNames.Length; i++) { string projectName = projectNames[i]; Console.WriteLine(projectName); var template = $"auth_client account elevate [email protected] {projectName} --message=\"ryan support\""; Console.WriteLine(template); // elevate permission ExecuteCommandSync(template); var listDeploymentsRequest = new ListDeploymentsRequest { ProjectName = projectName, View = ViewType.Full, }; try { var deployments = DeploymentServiceClient.ListDeployments(listDeploymentsRequest); foreach (var deployment in deployments) { int count = deployment.WorkerFlags.Count; if (count > 0) { isWorkflagUsed = true; break; } } if (isWorkflagUsed) { Console.WriteLine("Customer:{0}, Project:{1} is using workflag.", customer_name, projectName); } } catch (Exception e) { Console.WriteLine(e.Message); } } } }
/// <summary>Snippet for ListDeploymentsAsync</summary> public async Task ListDeploymentsRequestObjectAsync() { // Snippet: ListDeploymentsAsync(ListDeploymentsRequest, CallSettings) // Create client DeploymentsClient deploymentsClient = await DeploymentsClient.CreateAsync(); // Initialize request argument(s) ListDeploymentsRequest request = new ListDeploymentsRequest { ParentAsEnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"), }; // Make the request PagedAsyncEnumerable <ListDeploymentsResponse, Deployment> response = deploymentsClient.ListDeploymentsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Deployment item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListDeploymentsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Deployment item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Deployment> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Deployment item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary> /// Creates a new enumerable which will iterate over the DeploymentSummary objects /// contained in responses from the ListDeployments operation. This enumerable will fetch more data from the server as needed. /// </summary> /// <param name="request">The request object containing the details to send</param> /// <param name="retryConfiguration">The configuration for retrying, may be null</param> /// <param name="cancellationToken">The cancellation token object</param> /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns> public IEnumerable <DeploymentSummary> ListDeploymentsRecordEnumerator(ListDeploymentsRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { return(new Common.Utils.ResponseRecordEnumerable <ListDeploymentsRequest, ListDeploymentsResponse, DeploymentSummary>( response => response.OpcNextPage, input => { if (!string.IsNullOrEmpty(input)) { request.Page = input; } return request; }, request => client.ListDeployments(request, retryConfiguration, cancellationToken), response => response.DeploymentCollection.Items )); }
public async Task <IEnumerable <DeploymentDto> > Handle(ListDeploymentsRequest request, CancellationToken cancellationToken) { var entities = await _deploymentRepository .RetrieveAllDeploymentsAsync(request.Skip, request.Take); if (entities == null) { throw new StatusException(StatusCodes.Status500InternalServerError, "Could not retrieve any deployments."); } var deployments = _mapper.Map <IEnumerable <DeploymentDto> >(entities); return(deployments); }
/// <summary>Snippet for ListDeployments</summary> public void ListDeploymentsRequestObject() { // Snippet: ListDeployments(ListDeploymentsRequest, CallSettings) // Create client GSuiteAddOnsClient gSuiteAddOnsClient = GSuiteAddOnsClient.Create(); // Initialize request argument(s) ListDeploymentsRequest request = new ListDeploymentsRequest { ParentAsProjectName = ProjectName.FromProject("[PROJECT]"), }; // Make the request PagedEnumerable <ListDeploymentsResponse, Deployment> response = gSuiteAddOnsClient.ListDeployments(request); // Iterate over all response items, lazily performing RPCs as required foreach (Deployment item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListDeploymentsResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Deployment item in page) { // Do something with each item Console.WriteLine(item); } } // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Deployment> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Deployment item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
protected override void Run() { Console.WriteLine("Creating a PlayerIdentityToken"); var playerIdentityTokenResponse = _playerAuthServiceClient.CreatePlayerIdentityToken( new CreatePlayerIdentityTokenRequest { Provider = "provider", PlayerIdentifier = "player_identifier", ProjectName = ProjectName }); Console.WriteLine("Verifying PlayerIdentityToken"); var decodePlayerIdentityTokenResponse = _playerAuthServiceClient.DecodePlayerIdentityToken( new DecodePlayerIdentityTokenRequest { PlayerIdentityToken = playerIdentityTokenResponse.PlayerIdentityToken }); var playerIdentityToken = decodePlayerIdentityTokenResponse.PlayerIdentityToken; if (playerIdentityToken.Provider != "provider") { throw new Exception("Provider not recognised."); } if (playerIdentityToken.ProjectName != ProjectName) { throw new Exception("Project not recognised."); } if (DateTime.Now.CompareTo(playerIdentityToken.ExpiryTime.ToDateTime()) > 0) { throw new Exception("PlayerIdentityToken expired."); } Console.WriteLine("Choosing a deployment"); var listDeploymentsRequest = new ListDeploymentsRequest { ProjectName = ProjectName, Filters = { new Filter { TagsPropertyFilter = new TagsPropertyFilter { Tag = "player_auth_tag", Operator = TagsPropertyFilter.Types.Operator.Equal, }, } } }; var suitableDeployment = _deploymentServiceClient.ListDeployments(listDeploymentsRequest).First(); Console.WriteLine("Creating a LoginToken for the selected deployment"); var createLoginTokenResponse = _playerAuthServiceClient.CreateLoginToken( new CreateLoginTokenRequest { PlayerIdentityToken = playerIdentityTokenResponse.PlayerIdentityToken, DeploymentId = suitableDeployment.Id.ToString(), LifetimeDuration = Duration.FromTimeSpan(new TimeSpan(0, 0, 30, 0)), WorkerType = ScenarioWorkerType }); Console.WriteLine("Connecting to the deployment using the LoginToken and PlayerIdentityToken"); var locatorParameters = new LocatorParameters { PlayerIdentity = new PlayerIdentityCredentials { PlayerIdentityToken = playerIdentityTokenResponse.PlayerIdentityToken, LoginToken = createLoginTokenResponse.LoginToken } }; var locator = new Locator(LocatorServerAddress, LocatorServerPort, locatorParameters); using (var connectionFuture = locator.ConnectAsync(new ConnectionParameters { WorkerType = ScenarioWorkerType, Network = { ConnectionType = NetworkConnectionType.Tcp, UseExternalIp = true } })) { var connFuture = connectionFuture.Get(Convert.ToUInt32(Defaults.ConnectionTimeoutMillis)); if (!connFuture.HasValue || !connFuture.Value.IsConnected) { throw new Exception("No connection or connection not established"); } Console.WriteLine($"Assigned worker ID: {connFuture.Value.GetWorkerId()}"); } }
partial void Modify_ListDeploymentsRequest(ref ListDeploymentsRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Returns the list of all deployments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A pageable asynchronous sequence of <see cref="Deployment"/> resources.</returns> public virtual gax::PagedAsyncEnumerable <ListDeploymentsResponse, Deployment> ListDeploymentsAsync(ListDeploymentsRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();