protected override void ProcessRecord() { base.ProcessRecord(); ListWorkspacesRequest request; try { request = new ListWorkspacesRequest { CompartmentId = CompartmentId, Name = Name, Limit = Limit, Page = Page, LifecycleState = LifecycleState, SortOrder = SortOrder, SortBy = SortBy, OpcRequestId = OpcRequestId }; IEnumerable <ListWorkspacesResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.Items, 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); } }
protected override void ProcessRecord() { base.ProcessRecord(); ListWorkspacesRequest request; try { request = new ListWorkspacesRequest { CompartmentId = CompartmentId, Name = Name, Limit = Limit, Page = Page, LifecycleState = LifecycleState, SortOrder = SortOrder, SortBy = SortBy, OpcRequestId = OpcRequestId }; IEnumerable <ListWorkspacesResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.Items, true); } FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonPrometheusServiceConfig config = new AmazonPrometheusServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonPrometheusServiceClient client = new AmazonPrometheusServiceClient(creds, config); ListWorkspacesResponse resp = new ListWorkspacesResponse(); do { ListWorkspacesRequest req = new ListWorkspacesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListWorkspaces(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Workspaces) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
/// <summary> /// Lists all AMP workspaces, including workspaces being created or deleted. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListWorkspaces service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the ListWorkspaces service method, as returned by PrometheusService.</returns> /// <exception cref="Amazon.PrometheusService.Model.AccessDeniedException"> /// User does not have sufficient access to perform this action. /// </exception> /// <exception cref="Amazon.PrometheusService.Model.InternalServerException"> /// Unexpected error during processing of request. /// </exception> /// <exception cref="Amazon.PrometheusService.Model.ThrottlingException"> /// Request was denied due to request throttling. /// </exception> /// <exception cref="Amazon.PrometheusService.Model.ValidationException"> /// The input fails to satisfy the constraints specified by an AWS service. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/ListWorkspaces">REST API Reference for ListWorkspaces Operation</seealso> public virtual Task <ListWorkspacesResponse> ListWorkspacesAsync(ListWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListWorkspacesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListWorkspacesResponseUnmarshaller.Instance; return(InvokeAsync <ListWorkspacesResponse>(request, options, cancellationToken)); }
internal virtual ListWorkspacesResponse ListWorkspaces(ListWorkspacesRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListWorkspacesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListWorkspacesResponseUnmarshaller.Instance; return(Invoke <ListWorkspacesResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the ListWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListWorkspaces operation on AmazonPrometheusServiceClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListWorkspaces /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/ListWorkspaces">REST API Reference for ListWorkspaces Operation</seealso> public virtual IAsyncResult BeginListWorkspaces(ListWorkspacesRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = ListWorkspacesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListWorkspacesResponseUnmarshaller.Instance; return(BeginInvoke(request, options, callback, state)); }
/// <summary>Snippet for ListWorkspacesAsync</summary> public async Task ListWorkspacesRequestObjectAsync() { // Snippet: ListWorkspacesAsync(ListWorkspacesRequest, CallSettings) // Create client TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync(); // Initialize request argument(s) ListWorkspacesRequest request = new ListWorkspacesRequest { }; // Make the request PagedAsyncEnumerable <ListWorkspacesResponse, Workspace> response = tablesServiceClient.ListWorkspacesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Workspace 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((ListWorkspacesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Workspace 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 <Workspace> 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 (Workspace 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>Snippet for ListWorkspaces</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void ListWorkspacesRequestObject() { // Create client TablesServiceClient tablesServiceClient = TablesServiceClient.Create(); // Initialize request argument(s) ListWorkspacesRequest request = new ListWorkspacesRequest { }; // Make the request PagedEnumerable <ListWorkspacesResponse, Workspace> response = tablesServiceClient.ListWorkspaces(request); // Iterate over all response items, lazily performing RPCs as required foreach (Workspace 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 (ListWorkspacesResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Workspace 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 <Workspace> 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 (Workspace 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; }