/// <summary> /// Gets the deployment info /// </summary> /// <param name="deploymentID">A deployment ID associated with the applicable IAM user or AWS account.</param> /// <param name="settings">The <see cref="DeploySettings"/> used during the request to AWS.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> public async Task <DeploymentInfo> GetDeploymentInfo(string deploymentID, DeploySettings settings, CancellationToken cancellationToken = default(CancellationToken)) { if (String.IsNullOrEmpty(deploymentID)) { throw new ArgumentNullException("deploymentID"); } // Create Request AmazonCodeDeployClient client = this.CreateClient(settings); GetDeploymentRequest request = new GetDeploymentRequest(); request.DeploymentId = deploymentID; // Check Response GetDeploymentResponse response = await client.GetDeploymentAsync(request, cancellationToken); if (response.HttpStatusCode == HttpStatusCode.OK) { _Log.Verbose("Successfully found deployment info '{0}'", deploymentID); return(response.DeploymentInfo); } else { _Log.Error("Failed to get deployment info '{0}'", deploymentID); return(null); } }
internal static GetDeploymentResponse GetDeployment(string deploymentId, string region) { try { GetDeploymentRequest request = new GetDeploymentRequest() { DeploymentId = deploymentId }; AmazonCodeDeployClient client = string.IsNullOrEmpty(region) ? new AmazonCodeDeployClient() : new AmazonCodeDeployClient(RegionEndpoint.GetBySystemName(region)); Task <GetDeploymentResponse> response = client.GetDeploymentAsync(request); Task.WaitAll(new Task[] { response }); return(response.Result); } catch (System.Exception e) { Log.Error($"{e.GetBaseException().GetType().Name}: {e.Message}"); return(null); } }