Beispiel #1
0
 private Amazon.Proton.Model.UpdateEnvironmentResponse CallAWSServiceOperation(IAmazonProton client, Amazon.Proton.Model.UpdateEnvironmentRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Proton", "UpdateEnvironment");
     try
     {
         #if DESKTOP
         return(client.UpdateEnvironment(request));
         #elif CORECLR
         return(client.UpdateEnvironmentAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Proton.Model.UpdateEnvironmentRequest();

            if (cmdletContext.DeploymentType != null)
            {
                request.DeploymentType = cmdletContext.DeploymentType;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.EnvironmentAccountConnectionId != null)
            {
                request.EnvironmentAccountConnectionId = cmdletContext.EnvironmentAccountConnectionId;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.ProtonServiceRoleArn != null)
            {
                request.ProtonServiceRoleArn = cmdletContext.ProtonServiceRoleArn;
            }

            // populate ProvisioningRepository
            var requestProvisioningRepositoryIsNull = true;

            request.ProvisioningRepository = new Amazon.Proton.Model.RepositoryBranchInput();
            System.String requestProvisioningRepository_provisioningRepository_Branch = null;
            if (cmdletContext.ProvisioningRepository_Branch != null)
            {
                requestProvisioningRepository_provisioningRepository_Branch = cmdletContext.ProvisioningRepository_Branch;
            }
            if (requestProvisioningRepository_provisioningRepository_Branch != null)
            {
                request.ProvisioningRepository.Branch = requestProvisioningRepository_provisioningRepository_Branch;
                requestProvisioningRepositoryIsNull   = false;
            }
            System.String requestProvisioningRepository_provisioningRepository_Name = null;
            if (cmdletContext.ProvisioningRepository_Name != null)
            {
                requestProvisioningRepository_provisioningRepository_Name = cmdletContext.ProvisioningRepository_Name;
            }
            if (requestProvisioningRepository_provisioningRepository_Name != null)
            {
                request.ProvisioningRepository.Name = requestProvisioningRepository_provisioningRepository_Name;
                requestProvisioningRepositoryIsNull = false;
            }
            Amazon.Proton.RepositoryProvider requestProvisioningRepository_provisioningRepository_Provider = null;
            if (cmdletContext.ProvisioningRepository_Provider != null)
            {
                requestProvisioningRepository_provisioningRepository_Provider = cmdletContext.ProvisioningRepository_Provider;
            }
            if (requestProvisioningRepository_provisioningRepository_Provider != null)
            {
                request.ProvisioningRepository.Provider = requestProvisioningRepository_provisioningRepository_Provider;
                requestProvisioningRepositoryIsNull     = false;
            }
            // determine if request.ProvisioningRepository should be set to null
            if (requestProvisioningRepositoryIsNull)
            {
                request.ProvisioningRepository = null;
            }
            if (cmdletContext.Spec != null)
            {
                request.Spec = cmdletContext.Spec;
            }
            if (cmdletContext.TemplateMajorVersion != null)
            {
                request.TemplateMajorVersion = cmdletContext.TemplateMajorVersion;
            }
            if (cmdletContext.TemplateMinorVersion != null)
            {
                request.TemplateMinorVersion = cmdletContext.TemplateMinorVersion;
            }

            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);
        }