public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ECS.Model.UpdateContainerAgentRequest(); if (cmdletContext.Cluster != null) { request.Cluster = cmdletContext.Cluster; } if (cmdletContext.ContainerInstance != null) { request.ContainerInstance = cmdletContext.ContainerInstance; } 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 UpdateContainerAgent operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateContainerAgent 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<UpdateContainerAgentResponse> UpdateContainerAgentAsync(UpdateContainerAgentRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateContainerAgentRequestMarshaller(); var unmarshaller = UpdateContainerAgentResponseUnmarshaller.Instance; return InvokeAsync<UpdateContainerAgentRequest,UpdateContainerAgentResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Updates the Amazon ECS container agent on a specified container instance. Updating /// the Amazon ECS container agent does not interrupt running tasks or services on the /// container instance. The process for updating the agent differs depending on whether /// your container instance was launched with the Amazon ECS-optimized AMI or another /// operating system. /// /// /// <para> /// <code>UpdateContainerAgent</code> requires the Amazon ECS-optimized AMI or Amazon /// Linux with the <code>ecs-init</code> service installed and running. For help updating /// the Amazon ECS container agent on other operating systems, see <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-update.html#manually_update_agent">Manually /// Updating the Amazon ECS Container Agent</a> in the <i>Amazon EC2 Container Service /// Developer Guide</i>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateContainerAgent service method.</param> /// /// <returns>The response from the UpdateContainerAgent service method, as returned by ECS.</returns> /// <exception cref="Amazon.ECS.Model.ClientException"> /// These errors are usually caused by something the client did, such as use an action /// or resource on behalf of a user that doesn't have permission to use the action or /// resource, or specify an identifier that is not valid. /// </exception> /// <exception cref="Amazon.ECS.Model.ClusterNotFoundException"> /// The specified cluster could not be found. You can view your available clusters with /// <a>ListClusters</a>. Amazon ECS clusters are region-specific. /// </exception> /// <exception cref="Amazon.ECS.Model.InvalidParameterException"> /// The specified parameter is invalid. Review the available parameters for the API request. /// </exception> /// <exception cref="Amazon.ECS.Model.MissingVersionException"> /// Amazon ECS is unable to determine the current version of the Amazon ECS container /// agent on the container instance and does not have enough information to proceed with /// an update. This could be because the agent running on the container instance is an /// older or custom version that does not use our version information. /// </exception> /// <exception cref="Amazon.ECS.Model.NoUpdateAvailableException"> /// There is no update available for this Amazon ECS container agent. This could be because /// the agent is already running the latest version, or it is so old that there is no /// update path to the current version. /// </exception> /// <exception cref="Amazon.ECS.Model.ServerException"> /// These errors are usually caused by a server-side issue. /// </exception> /// <exception cref="Amazon.ECS.Model.UpdateInProgressException"> /// There is already a current Amazon ECS container agent update in progress on the specified /// container instance. If the container agent becomes disconnected while it is in a transitional /// stage, such as <code>PENDING</code> or <code>STAGING</code>, the update process can /// get stuck in that state. However, when the agent reconnects, it will resume where /// it stopped previously. /// </exception> public UpdateContainerAgentResponse UpdateContainerAgent(UpdateContainerAgentRequest request) { var marshaller = new UpdateContainerAgentRequestMarshaller(); var unmarshaller = UpdateContainerAgentResponseUnmarshaller.Instance; return Invoke<UpdateContainerAgentRequest,UpdateContainerAgentResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the UpdateContainerAgent operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateContainerAgent operation on AmazonECSClient.</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 EndUpdateContainerAgent /// operation.</returns> public IAsyncResult BeginUpdateContainerAgent(UpdateContainerAgentRequest request, AsyncCallback callback, object state) { var marshaller = new UpdateContainerAgentRequestMarshaller(); var unmarshaller = UpdateContainerAgentResponseUnmarshaller.Instance; return BeginInvoke<UpdateContainerAgentRequest>(request, marshaller, unmarshaller, callback, state); }
private Amazon.ECS.Model.UpdateContainerAgentResponse CallAWSServiceOperation(IAmazonECS client, Amazon.ECS.Model.UpdateContainerAgentRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon EC2 Container Service", "UpdateContainerAgent"); try { #if DESKTOP return(client.UpdateContainerAgent(request)); #elif CORECLR return(client.UpdateContainerAgentAsync(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; } }