예제 #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ApiGatewayV2.Model.CreateDomainNameRequest();

            if (cmdletContext.DomainName != null)
            {
                request.DomainName = cmdletContext.DomainName;
            }
            if (cmdletContext.DomainNameConfiguration != null)
            {
                request.DomainNameConfigurations = cmdletContext.DomainNameConfiguration;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }
예제 #2
0
 private Amazon.ApiGatewayV2.Model.CreateDomainNameResponse CallAWSServiceOperation(IAmazonApiGatewayV2 client, Amazon.ApiGatewayV2.Model.CreateDomainNameRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon API Gateway V2", "CreateDomainName");
     try
     {
         #if DESKTOP
         return(client.CreateDomainName(request));
         #elif CORECLR
         return(client.CreateDomainNameAsync(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;
     }
 }
예제 #3
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ApiGatewayV2.Model.CreateDomainNameRequest();

            if (cmdletContext.DomainName != null)
            {
                request.DomainName = cmdletContext.DomainName;
            }
            if (cmdletContext.DomainNameConfiguration != null)
            {
                request.DomainNameConfigurations = cmdletContext.DomainNameConfiguration;
            }

            // populate MutualTlsAuthentication
            var requestMutualTlsAuthenticationIsNull = true;

            request.MutualTlsAuthentication = new Amazon.ApiGatewayV2.Model.MutualTlsAuthenticationInput();
            System.String requestMutualTlsAuthentication_mutualTlsAuthentication_TruststoreUri = null;
            if (cmdletContext.MutualTlsAuthentication_TruststoreUri != null)
            {
                requestMutualTlsAuthentication_mutualTlsAuthentication_TruststoreUri = cmdletContext.MutualTlsAuthentication_TruststoreUri;
            }
            if (requestMutualTlsAuthentication_mutualTlsAuthentication_TruststoreUri != null)
            {
                request.MutualTlsAuthentication.TruststoreUri = requestMutualTlsAuthentication_mutualTlsAuthentication_TruststoreUri;
                requestMutualTlsAuthenticationIsNull          = false;
            }
            System.String requestMutualTlsAuthentication_mutualTlsAuthentication_TruststoreVersion = null;
            if (cmdletContext.MutualTlsAuthentication_TruststoreVersion != null)
            {
                requestMutualTlsAuthentication_mutualTlsAuthentication_TruststoreVersion = cmdletContext.MutualTlsAuthentication_TruststoreVersion;
            }
            if (requestMutualTlsAuthentication_mutualTlsAuthentication_TruststoreVersion != null)
            {
                request.MutualTlsAuthentication.TruststoreVersion = requestMutualTlsAuthentication_mutualTlsAuthentication_TruststoreVersion;
                requestMutualTlsAuthenticationIsNull = false;
            }
            // determine if request.MutualTlsAuthentication should be set to null
            if (requestMutualTlsAuthenticationIsNull)
            {
                request.MutualTlsAuthentication = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

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