public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CloudTrail.Model.RemoveTagsRequest(); if (cmdletContext.ResourceId != null) { request.ResourceId = cmdletContext.ResourceId; } if (cmdletContext.TagsList != null) { request.TagsList = cmdletContext.TagsList; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
/// <summary> /// Initiates the asynchronous execution of the RemoveTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RemoveTags 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 EndRemoveTags /// operation.</returns> public IAsyncResult BeginRemoveTags(RemoveTagsRequest request, AsyncCallback callback, object state) { var marshaller = new RemoveTagsRequestMarshaller(); var unmarshaller = RemoveTagsResponseUnmarshaller.Instance; return BeginInvoke<RemoveTagsRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Removes the specified tags from a trail. /// </summary> /// <param name="request">Container for the necessary parameters to execute the RemoveTags service method.</param> /// /// <returns>The response from the RemoveTags 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.InvalidTagParameterException"> /// This exception is thrown when the key or value specified for the tag does not match /// the regular expression <code>^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$</code>. /// </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 RemoveTagsResponse RemoveTags(RemoveTagsRequest request) { var marshaller = new RemoveTagsRequestMarshaller(); var unmarshaller = RemoveTagsResponseUnmarshaller.Instance; return Invoke<RemoveTagsRequest,RemoveTagsResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the RemoveTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RemoveTags 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<RemoveTagsResponse> RemoveTagsAsync(RemoveTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RemoveTagsRequestMarshaller(); var unmarshaller = RemoveTagsResponseUnmarshaller.Instance; return InvokeAsync<RemoveTagsRequest,RemoveTagsResponse>(request, marshaller, unmarshaller, cancellationToken); }
private Amazon.CloudTrail.Model.RemoveTagsResponse CallAWSServiceOperation(IAmazonCloudTrail client, Amazon.CloudTrail.Model.RemoveTagsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudTrail", "RemoveTags"); try { #if DESKTOP return(client.RemoveTags(request)); #elif CORECLR return(client.RemoveTagsAsync(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; } }