Container for the parameters to the CreateStage operation. Creates a new Stage resource that references a pre-existing Deployment for the API.
Inheritance: AmazonAPIGatewayRequest
コード例 #1
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateStage operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateStage operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<CreateStageResponse> CreateStageAsync(CreateStageRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateStageRequestMarshaller();
            var unmarshaller = CreateStageResponseUnmarshaller.Instance;

            return InvokeAsync<CreateStageRequest,CreateStageResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
コード例 #2
0
        internal CreateStageResponse CreateStage(CreateStageRequest request)
        {
            var marshaller = new CreateStageRequestMarshaller();
            var unmarshaller = CreateStageResponseUnmarshaller.Instance;

            return Invoke<CreateStageRequest,CreateStageResponse>(request, marshaller, unmarshaller);
        }
コード例 #3
0
 private Amazon.APIGateway.Model.CreateStageResponse CallAWSServiceOperation(IAmazonAPIGateway client, Amazon.APIGateway.Model.CreateStageRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon API Gateway", "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;
     }
 }
コード例 #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateStage operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateStage operation on AmazonAPIGatewayClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateStage
        ///         operation.</returns>
        public IAsyncResult BeginCreateStage(CreateStageRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateStageRequestMarshaller();
            var unmarshaller = CreateStageResponseUnmarshaller.Instance;

            return BeginInvoke<CreateStageRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
コード例 #5
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.APIGateway.Model.CreateStageRequest();

            if (cmdletContext.CacheClusterEnabled != null)
            {
                request.CacheClusterEnabled = cmdletContext.CacheClusterEnabled.Value;
            }
            if (cmdletContext.CacheClusterSize != null)
            {
                request.CacheClusterSize = cmdletContext.CacheClusterSize;
            }

            // populate CanarySettings
            var requestCanarySettingsIsNull = true;

            request.CanarySettings = new Amazon.APIGateway.Model.CanarySettings();
            System.String requestCanarySettings_canarySettings_DeploymentId = null;
            if (cmdletContext.CanarySettings_DeploymentId != null)
            {
                requestCanarySettings_canarySettings_DeploymentId = cmdletContext.CanarySettings_DeploymentId;
            }
            if (requestCanarySettings_canarySettings_DeploymentId != null)
            {
                request.CanarySettings.DeploymentId = requestCanarySettings_canarySettings_DeploymentId;
                requestCanarySettingsIsNull         = false;
            }
            System.Double?requestCanarySettings_canarySettings_PercentTraffic = null;
            if (cmdletContext.CanarySettings_PercentTraffic != null)
            {
                requestCanarySettings_canarySettings_PercentTraffic = cmdletContext.CanarySettings_PercentTraffic.Value;
            }
            if (requestCanarySettings_canarySettings_PercentTraffic != null)
            {
                request.CanarySettings.PercentTraffic = requestCanarySettings_canarySettings_PercentTraffic.Value;
                requestCanarySettingsIsNull           = false;
            }
            Dictionary <System.String, System.String> requestCanarySettings_canarySettings_StageVariableOverride = null;

            if (cmdletContext.CanarySettings_StageVariableOverride != null)
            {
                requestCanarySettings_canarySettings_StageVariableOverride = cmdletContext.CanarySettings_StageVariableOverride;
            }
            if (requestCanarySettings_canarySettings_StageVariableOverride != null)
            {
                request.CanarySettings.StageVariableOverrides = requestCanarySettings_canarySettings_StageVariableOverride;
                requestCanarySettingsIsNull = false;
            }
            System.Boolean?requestCanarySettings_canarySettings_UseStageCache = null;
            if (cmdletContext.CanarySettings_UseStageCache != null)
            {
                requestCanarySettings_canarySettings_UseStageCache = cmdletContext.CanarySettings_UseStageCache.Value;
            }
            if (requestCanarySettings_canarySettings_UseStageCache != null)
            {
                request.CanarySettings.UseStageCache = requestCanarySettings_canarySettings_UseStageCache.Value;
                requestCanarySettingsIsNull          = false;
            }
            // determine if request.CanarySettings should be set to null
            if (requestCanarySettingsIsNull)
            {
                request.CanarySettings = null;
            }
            if (cmdletContext.DeploymentId != null)
            {
                request.DeploymentId = cmdletContext.DeploymentId;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.DocumentationVersion != null)
            {
                request.DocumentationVersion = cmdletContext.DocumentationVersion;
            }
            if (cmdletContext.RestApiId != null)
            {
                request.RestApiId = cmdletContext.RestApiId;
            }
            if (cmdletContext.StageName != null)
            {
                request.StageName = cmdletContext.StageName;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.TracingEnabled != null)
            {
                request.TracingEnabled = cmdletContext.TracingEnabled.Value;
            }
            if (cmdletContext.Variable != null)
            {
                request.Variables = cmdletContext.Variable;
            }

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