public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; var useParameterSelect = this.Select.StartsWith("^"); // create request and set iteration invariants var request = new Amazon.CloudTrail.Model.ListTagsRequest(); if (cmdletContext.ResourceIdList != null) { request.ResourceIdList = cmdletContext.ResourceIdList; } // Initialize loop variant and commence piping var _nextToken = cmdletContext.NextToken; var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.NextToken = _nextToken; CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; _nextToken = response.NextToken; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }
/// <summary> /// Initiates the asynchronous execution of the ListTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListTags operation on AmazonCloudTrailClient.</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 EndListTags /// operation.</returns> public IAsyncResult BeginListTags(ListTagsRequest request, AsyncCallback callback, object state) { var marshaller = new ListTagsRequestMarshaller(); var unmarshaller = ListTagsResponseUnmarshaller.Instance; return BeginInvoke<ListTagsRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Lists the tags for the trail in the current region. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListTags service method.</param> /// /// <returns>The response from the ListTags service method, as returned by CloudTrail.</returns> /// <exception cref="Amazon.CloudTrail.Model.CloudTrailARNInvalidException"> /// This exception is thrown when an operation is called with an invalid trail ARN. The /// format of a trail ARN is <code>arn:aws:cloudtrail:us-east-1:123456789012:trail/MyTrail</code>. /// </exception> /// <exception cref="Amazon.CloudTrail.Model.InvalidTokenException"> /// Reserved for future use. /// </exception> /// <exception cref="Amazon.CloudTrail.Model.InvalidTrailNameException"> /// This exception is thrown when the provided trail name is not valid. Trail names must /// meet the following requirements: /// /// <ul> <li>Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores /// (_), or dashes (-)</li> <li>Start with a letter or number, and end with a letter or /// number</li> <li>Be between 3 and 128 characters</li> <li>Have no adjacent periods, /// underscores or dashes. Names like <code>my-_namespace</code> and <code>my--namespace</code> /// are invalid.</li> <li>Not be in IP address format (for example, 192.168.5.4)</li> /// </ul> /// </exception> /// <exception cref="Amazon.CloudTrail.Model.OperationNotPermittedException"> /// This exception is thrown when the requested operation is not permitted. /// </exception> /// <exception cref="Amazon.CloudTrail.Model.ResourceNotFoundException"> /// This exception is thrown when the specified resource is not found. /// </exception> /// <exception cref="Amazon.CloudTrail.Model.ResourceTypeNotSupportedException"> /// This exception is thrown when the specified resource type is not supported by CloudTrail. /// </exception> /// <exception cref="Amazon.CloudTrail.Model.UnsupportedOperationException"> /// This exception is thrown when the requested operation is not supported. For example, /// this exception will occur if an attempt is made to tag a trail and tagging is not /// supported in the current region. /// </exception> public ListTagsResponse ListTags(ListTagsRequest request) { var marshaller = new ListTagsRequestMarshaller(); var unmarshaller = ListTagsResponseUnmarshaller.Instance; return Invoke<ListTagsRequest,ListTagsResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the ListTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListTags operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<ListTagsResponse> ListTagsAsync(ListTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListTagsRequestMarshaller(); var unmarshaller = ListTagsResponseUnmarshaller.Instance; return InvokeAsync<ListTagsRequest,ListTagsResponse>(request, marshaller, unmarshaller, cancellationToken); }
private Amazon.CloudTrail.Model.ListTagsResponse CallAWSServiceOperation(IAmazonCloudTrail client, Amazon.CloudTrail.Model.ListTagsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudTrail", "ListTags"); try { #if DESKTOP return(client.ListTags(request)); #elif CORECLR return(client.ListTagsAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
internal ListTagsPaginator(IAmazonCloudTrail client, ListTagsRequest request) { this._client = client; this._request = request; }
/// <summary> /// Paginator for ListTags operation ///</summary> public IListTagsPaginator ListTags(ListTagsRequest request) { return(new ListTagsPaginator(this.client, request)); }