private Amazon.ApiGatewayV2.Model.CreateStageResponse CallAWSServiceOperation(IAmazonApiGatewayV2 client, Amazon.ApiGatewayV2.Model.CreateStageRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon API Gateway V2", "CreateStage"); try { #if DESKTOP return(client.CreateStage(request)); #elif CORECLR return(client.CreateStageAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ApiGatewayV2.Model.CreateStageRequest(); // 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.AutoDeploy != null) { request.AutoDeploy = cmdletContext.AutoDeploy.Value; } 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; } 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); }