Exemplo n.º 1
0
 private Amazon.CodeStarconnections.Model.UpdateHostResponse CallAWSServiceOperation(IAmazonCodeStarconnections client, Amazon.CodeStarconnections.Model.UpdateHostRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CodeStar Connections", "UpdateHost");
     try
     {
         #if DESKTOP
         return(client.UpdateHost(request));
         #elif CORECLR
         return(client.UpdateHostAsync(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;
     }
 }
Exemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CodeStarconnections.Model.UpdateHostRequest();

            if (cmdletContext.HostArn != null)
            {
                request.HostArn = cmdletContext.HostArn;
            }
            if (cmdletContext.ProviderEndpoint != null)
            {
                request.ProviderEndpoint = cmdletContext.ProviderEndpoint;
            }

            // populate VpcConfiguration
            var requestVpcConfigurationIsNull = true;

            request.VpcConfiguration = new Amazon.CodeStarconnections.Model.VpcConfiguration();
            List <System.String> requestVpcConfiguration_vpcConfiguration_SecurityGroupId = null;

            if (cmdletContext.VpcConfiguration_SecurityGroupId != null)
            {
                requestVpcConfiguration_vpcConfiguration_SecurityGroupId = cmdletContext.VpcConfiguration_SecurityGroupId;
            }
            if (requestVpcConfiguration_vpcConfiguration_SecurityGroupId != null)
            {
                request.VpcConfiguration.SecurityGroupIds = requestVpcConfiguration_vpcConfiguration_SecurityGroupId;
                requestVpcConfigurationIsNull             = false;
            }
            List <System.String> requestVpcConfiguration_vpcConfiguration_SubnetId = null;

            if (cmdletContext.VpcConfiguration_SubnetId != null)
            {
                requestVpcConfiguration_vpcConfiguration_SubnetId = cmdletContext.VpcConfiguration_SubnetId;
            }
            if (requestVpcConfiguration_vpcConfiguration_SubnetId != null)
            {
                request.VpcConfiguration.SubnetIds = requestVpcConfiguration_vpcConfiguration_SubnetId;
                requestVpcConfigurationIsNull      = false;
            }
            System.String requestVpcConfiguration_vpcConfiguration_TlsCertificate = null;
            if (cmdletContext.VpcConfiguration_TlsCertificate != null)
            {
                requestVpcConfiguration_vpcConfiguration_TlsCertificate = cmdletContext.VpcConfiguration_TlsCertificate;
            }
            if (requestVpcConfiguration_vpcConfiguration_TlsCertificate != null)
            {
                request.VpcConfiguration.TlsCertificate = requestVpcConfiguration_vpcConfiguration_TlsCertificate;
                requestVpcConfigurationIsNull           = false;
            }
            System.String requestVpcConfiguration_vpcConfiguration_VpcId = null;
            if (cmdletContext.VpcConfiguration_VpcId != null)
            {
                requestVpcConfiguration_vpcConfiguration_VpcId = cmdletContext.VpcConfiguration_VpcId;
            }
            if (requestVpcConfiguration_vpcConfiguration_VpcId != null)
            {
                request.VpcConfiguration.VpcId = requestVpcConfiguration_vpcConfiguration_VpcId;
                requestVpcConfigurationIsNull  = false;
            }
            // determine if request.VpcConfiguration should be set to null
            if (requestVpcConfigurationIsNull)
            {
                request.VpcConfiguration = null;
            }

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