public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ApiGatewayV2.Model.UpdateApiRequest(); if (cmdletContext.ApiId != null) { request.ApiId = cmdletContext.ApiId; } if (cmdletContext.ApiKeySelectionExpression != null) { request.ApiKeySelectionExpression = cmdletContext.ApiKeySelectionExpression; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.DisableSchemaValidation != null) { request.DisableSchemaValidation = cmdletContext.DisableSchemaValidation.Value; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.RouteSelectionExpression != null) { request.RouteSelectionExpression = cmdletContext.RouteSelectionExpression; } if (cmdletContext.Version != null) { request.Version = cmdletContext.Version; } 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); }
private Amazon.ApiGatewayV2.Model.UpdateApiResponse CallAWSServiceOperation(IAmazonApiGatewayV2 client, Amazon.ApiGatewayV2.Model.UpdateApiRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon API Gateway V2", "UpdateApi"); try { #if DESKTOP return(client.UpdateApi(request)); #elif CORECLR return(client.UpdateApiAsync(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.UpdateApiRequest(); if (cmdletContext.ApiId != null) { request.ApiId = cmdletContext.ApiId; } if (cmdletContext.ApiKeySelectionExpression != null) { request.ApiKeySelectionExpression = cmdletContext.ApiKeySelectionExpression; } // populate CorsConfiguration var requestCorsConfigurationIsNull = true; request.CorsConfiguration = new Amazon.ApiGatewayV2.Model.Cors(); System.Boolean?requestCorsConfiguration_corsConfiguration_AllowCredential = null; if (cmdletContext.CorsConfiguration_AllowCredential != null) { requestCorsConfiguration_corsConfiguration_AllowCredential = cmdletContext.CorsConfiguration_AllowCredential.Value; } if (requestCorsConfiguration_corsConfiguration_AllowCredential != null) { request.CorsConfiguration.AllowCredentials = requestCorsConfiguration_corsConfiguration_AllowCredential.Value; requestCorsConfigurationIsNull = false; } List <System.String> requestCorsConfiguration_corsConfiguration_AllowHeader = null; if (cmdletContext.CorsConfiguration_AllowHeader != null) { requestCorsConfiguration_corsConfiguration_AllowHeader = cmdletContext.CorsConfiguration_AllowHeader; } if (requestCorsConfiguration_corsConfiguration_AllowHeader != null) { request.CorsConfiguration.AllowHeaders = requestCorsConfiguration_corsConfiguration_AllowHeader; requestCorsConfigurationIsNull = false; } List <System.String> requestCorsConfiguration_corsConfiguration_AllowMethod = null; if (cmdletContext.CorsConfiguration_AllowMethod != null) { requestCorsConfiguration_corsConfiguration_AllowMethod = cmdletContext.CorsConfiguration_AllowMethod; } if (requestCorsConfiguration_corsConfiguration_AllowMethod != null) { request.CorsConfiguration.AllowMethods = requestCorsConfiguration_corsConfiguration_AllowMethod; requestCorsConfigurationIsNull = false; } List <System.String> requestCorsConfiguration_corsConfiguration_AllowOrigin = null; if (cmdletContext.CorsConfiguration_AllowOrigin != null) { requestCorsConfiguration_corsConfiguration_AllowOrigin = cmdletContext.CorsConfiguration_AllowOrigin; } if (requestCorsConfiguration_corsConfiguration_AllowOrigin != null) { request.CorsConfiguration.AllowOrigins = requestCorsConfiguration_corsConfiguration_AllowOrigin; requestCorsConfigurationIsNull = false; } List <System.String> requestCorsConfiguration_corsConfiguration_ExposeHeader = null; if (cmdletContext.CorsConfiguration_ExposeHeader != null) { requestCorsConfiguration_corsConfiguration_ExposeHeader = cmdletContext.CorsConfiguration_ExposeHeader; } if (requestCorsConfiguration_corsConfiguration_ExposeHeader != null) { request.CorsConfiguration.ExposeHeaders = requestCorsConfiguration_corsConfiguration_ExposeHeader; requestCorsConfigurationIsNull = false; } System.Int32?requestCorsConfiguration_corsConfiguration_MaxAge = null; if (cmdletContext.CorsConfiguration_MaxAge != null) { requestCorsConfiguration_corsConfiguration_MaxAge = cmdletContext.CorsConfiguration_MaxAge.Value; } if (requestCorsConfiguration_corsConfiguration_MaxAge != null) { request.CorsConfiguration.MaxAge = requestCorsConfiguration_corsConfiguration_MaxAge.Value; requestCorsConfigurationIsNull = false; } // determine if request.CorsConfiguration should be set to null if (requestCorsConfigurationIsNull) { request.CorsConfiguration = null; } if (cmdletContext.CredentialsArn != null) { request.CredentialsArn = cmdletContext.CredentialsArn; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.DisableSchemaValidation != null) { request.DisableSchemaValidation = cmdletContext.DisableSchemaValidation.Value; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.RouteKey != null) { request.RouteKey = cmdletContext.RouteKey; } if (cmdletContext.RouteSelectionExpression != null) { request.RouteSelectionExpression = cmdletContext.RouteSelectionExpression; } if (cmdletContext.Target != null) { request.Target = cmdletContext.Target; } if (cmdletContext.Version != null) { request.Version = cmdletContext.Version; } 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); }