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


            // populate AccessLogSettings
            var requestAccessLogSettingsIsNull = true;

            request.AccessLogSettings = new Amazon.ApiGatewayV2.Model.AccessLogSettings();
            System.String requestAccessLogSettings_accessLogSettings_DestinationArn = null;
            if (cmdletContext.AccessLogSettings_DestinationArn != null)
            {
                requestAccessLogSettings_accessLogSettings_DestinationArn = cmdletContext.AccessLogSettings_DestinationArn;
            }
            if (requestAccessLogSettings_accessLogSettings_DestinationArn != null)
            {
                request.AccessLogSettings.DestinationArn = requestAccessLogSettings_accessLogSettings_DestinationArn;
                requestAccessLogSettingsIsNull           = false;
            }
            System.String requestAccessLogSettings_accessLogSettings_Format = null;
            if (cmdletContext.AccessLogSettings_Format != null)
            {
                requestAccessLogSettings_accessLogSettings_Format = cmdletContext.AccessLogSettings_Format;
            }
            if (requestAccessLogSettings_accessLogSettings_Format != null)
            {
                request.AccessLogSettings.Format = requestAccessLogSettings_accessLogSettings_Format;
                requestAccessLogSettingsIsNull   = false;
            }
            // determine if request.AccessLogSettings should be set to null
            if (requestAccessLogSettingsIsNull)
            {
                request.AccessLogSettings = null;
            }
            if (cmdletContext.ApiId != null)
            {
                request.ApiId = cmdletContext.ApiId;
            }
            if (cmdletContext.ClientCertificateId != null)
            {
                request.ClientCertificateId = cmdletContext.ClientCertificateId;
            }

            // populate DefaultRouteSettings
            var requestDefaultRouteSettingsIsNull = true;

            request.DefaultRouteSettings = new Amazon.ApiGatewayV2.Model.RouteSettings();
            System.Boolean?requestDefaultRouteSettings_defaultRouteSettings_DataTraceEnabled = null;
            if (cmdletContext.DefaultRouteSettings_DataTraceEnabled != null)
            {
                requestDefaultRouteSettings_defaultRouteSettings_DataTraceEnabled = cmdletContext.DefaultRouteSettings_DataTraceEnabled.Value;
            }
            if (requestDefaultRouteSettings_defaultRouteSettings_DataTraceEnabled != null)
            {
                request.DefaultRouteSettings.DataTraceEnabled = requestDefaultRouteSettings_defaultRouteSettings_DataTraceEnabled.Value;
                requestDefaultRouteSettingsIsNull             = false;
            }
            System.Boolean?requestDefaultRouteSettings_defaultRouteSettings_DetailedMetricsEnabled = null;
            if (cmdletContext.DefaultRouteSettings_DetailedMetricsEnabled != null)
            {
                requestDefaultRouteSettings_defaultRouteSettings_DetailedMetricsEnabled = cmdletContext.DefaultRouteSettings_DetailedMetricsEnabled.Value;
            }
            if (requestDefaultRouteSettings_defaultRouteSettings_DetailedMetricsEnabled != null)
            {
                request.DefaultRouteSettings.DetailedMetricsEnabled = requestDefaultRouteSettings_defaultRouteSettings_DetailedMetricsEnabled.Value;
                requestDefaultRouteSettingsIsNull = false;
            }
            Amazon.ApiGatewayV2.LoggingLevel requestDefaultRouteSettings_defaultRouteSettings_LoggingLevel = null;
            if (cmdletContext.DefaultRouteSettings_LoggingLevel != null)
            {
                requestDefaultRouteSettings_defaultRouteSettings_LoggingLevel = cmdletContext.DefaultRouteSettings_LoggingLevel;
            }
            if (requestDefaultRouteSettings_defaultRouteSettings_LoggingLevel != null)
            {
                request.DefaultRouteSettings.LoggingLevel = requestDefaultRouteSettings_defaultRouteSettings_LoggingLevel;
                requestDefaultRouteSettingsIsNull         = false;
            }
            System.Int32?requestDefaultRouteSettings_defaultRouteSettings_ThrottlingBurstLimit = null;
            if (cmdletContext.DefaultRouteSettings_ThrottlingBurstLimit != null)
            {
                requestDefaultRouteSettings_defaultRouteSettings_ThrottlingBurstLimit = cmdletContext.DefaultRouteSettings_ThrottlingBurstLimit.Value;
            }
            if (requestDefaultRouteSettings_defaultRouteSettings_ThrottlingBurstLimit != null)
            {
                request.DefaultRouteSettings.ThrottlingBurstLimit = requestDefaultRouteSettings_defaultRouteSettings_ThrottlingBurstLimit.Value;
                requestDefaultRouteSettingsIsNull = false;
            }
            System.Double?requestDefaultRouteSettings_defaultRouteSettings_ThrottlingRateLimit = null;
            if (cmdletContext.DefaultRouteSettings_ThrottlingRateLimit != null)
            {
                requestDefaultRouteSettings_defaultRouteSettings_ThrottlingRateLimit = cmdletContext.DefaultRouteSettings_ThrottlingRateLimit.Value;
            }
            if (requestDefaultRouteSettings_defaultRouteSettings_ThrottlingRateLimit != null)
            {
                request.DefaultRouteSettings.ThrottlingRateLimit = requestDefaultRouteSettings_defaultRouteSettings_ThrottlingRateLimit.Value;
                requestDefaultRouteSettingsIsNull = false;
            }
            // determine if request.DefaultRouteSettings should be set to null
            if (requestDefaultRouteSettingsIsNull)
            {
                request.DefaultRouteSettings = null;
            }
            if (cmdletContext.DeploymentId != null)
            {
                request.DeploymentId = cmdletContext.DeploymentId;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.RouteSetting != null)
            {
                request.RouteSettings = cmdletContext.RouteSetting;
            }
            if (cmdletContext.StageName != null)
            {
                request.StageName = cmdletContext.StageName;
            }
            if (cmdletContext.StageVariable != null)
            {
                request.StageVariables = cmdletContext.StageVariable;
            }

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