private Amazon.CloudWatchEvents.Model.CreateConnectionResponse CallAWSServiceOperation(IAmazonCloudWatchEvents client, Amazon.CloudWatchEvents.Model.CreateConnectionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudWatch Events", "CreateConnection"); try { #if DESKTOP return(client.CreateConnection(request)); #elif CORECLR return(client.CreateConnectionAsync(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.CloudWatchEvents.Model.CreateConnectionRequest(); if (cmdletContext.AuthorizationType != null) { request.AuthorizationType = cmdletContext.AuthorizationType; } // populate AuthParameters var requestAuthParametersIsNull = true; request.AuthParameters = new Amazon.CloudWatchEvents.Model.CreateConnectionAuthRequestParameters(); Amazon.CloudWatchEvents.Model.CreateConnectionApiKeyAuthRequestParameters requestAuthParameters_authParameters_ApiKeyAuthParameters = null; // populate ApiKeyAuthParameters var requestAuthParameters_authParameters_ApiKeyAuthParametersIsNull = true; requestAuthParameters_authParameters_ApiKeyAuthParameters = new Amazon.CloudWatchEvents.Model.CreateConnectionApiKeyAuthRequestParameters(); System.String requestAuthParameters_authParameters_ApiKeyAuthParameters_apiKeyAuthParameters_ApiKeyName = null; if (cmdletContext.ApiKeyAuthParameters_ApiKeyName != null) { requestAuthParameters_authParameters_ApiKeyAuthParameters_apiKeyAuthParameters_ApiKeyName = cmdletContext.ApiKeyAuthParameters_ApiKeyName; } if (requestAuthParameters_authParameters_ApiKeyAuthParameters_apiKeyAuthParameters_ApiKeyName != null) { requestAuthParameters_authParameters_ApiKeyAuthParameters.ApiKeyName = requestAuthParameters_authParameters_ApiKeyAuthParameters_apiKeyAuthParameters_ApiKeyName; requestAuthParameters_authParameters_ApiKeyAuthParametersIsNull = false; } System.String requestAuthParameters_authParameters_ApiKeyAuthParameters_apiKeyAuthParameters_ApiKeyValue = null; if (cmdletContext.ApiKeyAuthParameters_ApiKeyValue != null) { requestAuthParameters_authParameters_ApiKeyAuthParameters_apiKeyAuthParameters_ApiKeyValue = cmdletContext.ApiKeyAuthParameters_ApiKeyValue; } if (requestAuthParameters_authParameters_ApiKeyAuthParameters_apiKeyAuthParameters_ApiKeyValue != null) { requestAuthParameters_authParameters_ApiKeyAuthParameters.ApiKeyValue = requestAuthParameters_authParameters_ApiKeyAuthParameters_apiKeyAuthParameters_ApiKeyValue; requestAuthParameters_authParameters_ApiKeyAuthParametersIsNull = false; } // determine if requestAuthParameters_authParameters_ApiKeyAuthParameters should be set to null if (requestAuthParameters_authParameters_ApiKeyAuthParametersIsNull) { requestAuthParameters_authParameters_ApiKeyAuthParameters = null; } if (requestAuthParameters_authParameters_ApiKeyAuthParameters != null) { request.AuthParameters.ApiKeyAuthParameters = requestAuthParameters_authParameters_ApiKeyAuthParameters; requestAuthParametersIsNull = false; } Amazon.CloudWatchEvents.Model.CreateConnectionBasicAuthRequestParameters requestAuthParameters_authParameters_BasicAuthParameters = null; // populate BasicAuthParameters var requestAuthParameters_authParameters_BasicAuthParametersIsNull = true; requestAuthParameters_authParameters_BasicAuthParameters = new Amazon.CloudWatchEvents.Model.CreateConnectionBasicAuthRequestParameters(); System.String requestAuthParameters_authParameters_BasicAuthParameters_basicAuthParameters_Password = null; if (cmdletContext.BasicAuthParameters_Password != null) { requestAuthParameters_authParameters_BasicAuthParameters_basicAuthParameters_Password = cmdletContext.BasicAuthParameters_Password; } if (requestAuthParameters_authParameters_BasicAuthParameters_basicAuthParameters_Password != null) { requestAuthParameters_authParameters_BasicAuthParameters.Password = requestAuthParameters_authParameters_BasicAuthParameters_basicAuthParameters_Password; requestAuthParameters_authParameters_BasicAuthParametersIsNull = false; } System.String requestAuthParameters_authParameters_BasicAuthParameters_basicAuthParameters_Username = null; if (cmdletContext.BasicAuthParameters_Username != null) { requestAuthParameters_authParameters_BasicAuthParameters_basicAuthParameters_Username = cmdletContext.BasicAuthParameters_Username; } if (requestAuthParameters_authParameters_BasicAuthParameters_basicAuthParameters_Username != null) { requestAuthParameters_authParameters_BasicAuthParameters.Username = requestAuthParameters_authParameters_BasicAuthParameters_basicAuthParameters_Username; requestAuthParameters_authParameters_BasicAuthParametersIsNull = false; } // determine if requestAuthParameters_authParameters_BasicAuthParameters should be set to null if (requestAuthParameters_authParameters_BasicAuthParametersIsNull) { requestAuthParameters_authParameters_BasicAuthParameters = null; } if (requestAuthParameters_authParameters_BasicAuthParameters != null) { request.AuthParameters.BasicAuthParameters = requestAuthParameters_authParameters_BasicAuthParameters; requestAuthParametersIsNull = false; } Amazon.CloudWatchEvents.Model.ConnectionHttpParameters requestAuthParameters_authParameters_InvocationHttpParameters = null; // populate InvocationHttpParameters var requestAuthParameters_authParameters_InvocationHttpParametersIsNull = true; requestAuthParameters_authParameters_InvocationHttpParameters = new Amazon.CloudWatchEvents.Model.ConnectionHttpParameters(); List <Amazon.CloudWatchEvents.Model.ConnectionBodyParameter> requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_BodyParameter = null; if (cmdletContext.InvocationHttpParameters_BodyParameter != null) { requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_BodyParameter = cmdletContext.InvocationHttpParameters_BodyParameter; } if (requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_BodyParameter != null) { requestAuthParameters_authParameters_InvocationHttpParameters.BodyParameters = requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_BodyParameter; requestAuthParameters_authParameters_InvocationHttpParametersIsNull = false; } List <Amazon.CloudWatchEvents.Model.ConnectionHeaderParameter> requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_HeaderParameter = null; if (cmdletContext.InvocationHttpParameters_HeaderParameter != null) { requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_HeaderParameter = cmdletContext.InvocationHttpParameters_HeaderParameter; } if (requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_HeaderParameter != null) { requestAuthParameters_authParameters_InvocationHttpParameters.HeaderParameters = requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_HeaderParameter; requestAuthParameters_authParameters_InvocationHttpParametersIsNull = false; } List <Amazon.CloudWatchEvents.Model.ConnectionQueryStringParameter> requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_QueryStringParameter = null; if (cmdletContext.InvocationHttpParameters_QueryStringParameter != null) { requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_QueryStringParameter = cmdletContext.InvocationHttpParameters_QueryStringParameter; } if (requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_QueryStringParameter != null) { requestAuthParameters_authParameters_InvocationHttpParameters.QueryStringParameters = requestAuthParameters_authParameters_InvocationHttpParameters_invocationHttpParameters_QueryStringParameter; requestAuthParameters_authParameters_InvocationHttpParametersIsNull = false; } // determine if requestAuthParameters_authParameters_InvocationHttpParameters should be set to null if (requestAuthParameters_authParameters_InvocationHttpParametersIsNull) { requestAuthParameters_authParameters_InvocationHttpParameters = null; } if (requestAuthParameters_authParameters_InvocationHttpParameters != null) { request.AuthParameters.InvocationHttpParameters = requestAuthParameters_authParameters_InvocationHttpParameters; requestAuthParametersIsNull = false; } Amazon.CloudWatchEvents.Model.CreateConnectionOAuthRequestParameters requestAuthParameters_authParameters_OAuthParameters = null; // populate OAuthParameters var requestAuthParameters_authParameters_OAuthParametersIsNull = true; requestAuthParameters_authParameters_OAuthParameters = new Amazon.CloudWatchEvents.Model.CreateConnectionOAuthRequestParameters(); System.String requestAuthParameters_authParameters_OAuthParameters_oAuthParameters_AuthorizationEndpoint = null; if (cmdletContext.OAuthParameters_AuthorizationEndpoint != null) { requestAuthParameters_authParameters_OAuthParameters_oAuthParameters_AuthorizationEndpoint = cmdletContext.OAuthParameters_AuthorizationEndpoint; } if (requestAuthParameters_authParameters_OAuthParameters_oAuthParameters_AuthorizationEndpoint != null) { requestAuthParameters_authParameters_OAuthParameters.AuthorizationEndpoint = requestAuthParameters_authParameters_OAuthParameters_oAuthParameters_AuthorizationEndpoint; requestAuthParameters_authParameters_OAuthParametersIsNull = false; } Amazon.CloudWatchEvents.ConnectionOAuthHttpMethod requestAuthParameters_authParameters_OAuthParameters_oAuthParameters_HttpMethod = null; if (cmdletContext.OAuthParameters_HttpMethod != null) { requestAuthParameters_authParameters_OAuthParameters_oAuthParameters_HttpMethod = cmdletContext.OAuthParameters_HttpMethod; } if (requestAuthParameters_authParameters_OAuthParameters_oAuthParameters_HttpMethod != null) { requestAuthParameters_authParameters_OAuthParameters.HttpMethod = requestAuthParameters_authParameters_OAuthParameters_oAuthParameters_HttpMethod; requestAuthParameters_authParameters_OAuthParametersIsNull = false; } Amazon.CloudWatchEvents.Model.CreateConnectionOAuthClientRequestParameters requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters = null; // populate ClientParameters var requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParametersIsNull = true; requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters = new Amazon.CloudWatchEvents.Model.CreateConnectionOAuthClientRequestParameters(); System.String requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters_clientParameters_ClientID = null; if (cmdletContext.ClientParameters_ClientID != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters_clientParameters_ClientID = cmdletContext.ClientParameters_ClientID; } if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters_clientParameters_ClientID != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters.ClientID = requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters_clientParameters_ClientID; requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParametersIsNull = false; } System.String requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters_clientParameters_ClientSecret = null; if (cmdletContext.ClientParameters_ClientSecret != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters_clientParameters_ClientSecret = cmdletContext.ClientParameters_ClientSecret; } if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters_clientParameters_ClientSecret != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters.ClientSecret = requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters_clientParameters_ClientSecret; requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParametersIsNull = false; } // determine if requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters should be set to null if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParametersIsNull) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters = null; } if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters != null) { requestAuthParameters_authParameters_OAuthParameters.ClientParameters = requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_ClientParameters; requestAuthParameters_authParameters_OAuthParametersIsNull = false; } Amazon.CloudWatchEvents.Model.ConnectionHttpParameters requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters = null; // populate OAuthHttpParameters var requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParametersIsNull = true; requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters = new Amazon.CloudWatchEvents.Model.ConnectionHttpParameters(); List <Amazon.CloudWatchEvents.Model.ConnectionBodyParameter> requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_BodyParameter = null; if (cmdletContext.OAuthHttpParameters_BodyParameter != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_BodyParameter = cmdletContext.OAuthHttpParameters_BodyParameter; } if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_BodyParameter != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters.BodyParameters = requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_BodyParameter; requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParametersIsNull = false; } List <Amazon.CloudWatchEvents.Model.ConnectionHeaderParameter> requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_HeaderParameter = null; if (cmdletContext.OAuthHttpParameters_HeaderParameter != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_HeaderParameter = cmdletContext.OAuthHttpParameters_HeaderParameter; } if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_HeaderParameter != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters.HeaderParameters = requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_HeaderParameter; requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParametersIsNull = false; } List <Amazon.CloudWatchEvents.Model.ConnectionQueryStringParameter> requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_QueryStringParameter = null; if (cmdletContext.OAuthHttpParameters_QueryStringParameter != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_QueryStringParameter = cmdletContext.OAuthHttpParameters_QueryStringParameter; } if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_QueryStringParameter != null) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters.QueryStringParameters = requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters_oAuthHttpParameters_QueryStringParameter; requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParametersIsNull = false; } // determine if requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters should be set to null if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParametersIsNull) { requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters = null; } if (requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters != null) { requestAuthParameters_authParameters_OAuthParameters.OAuthHttpParameters = requestAuthParameters_authParameters_OAuthParameters_authParameters_OAuthParameters_OAuthHttpParameters; requestAuthParameters_authParameters_OAuthParametersIsNull = false; } // determine if requestAuthParameters_authParameters_OAuthParameters should be set to null if (requestAuthParameters_authParameters_OAuthParametersIsNull) { requestAuthParameters_authParameters_OAuthParameters = null; } if (requestAuthParameters_authParameters_OAuthParameters != null) { request.AuthParameters.OAuthParameters = requestAuthParameters_authParameters_OAuthParameters; requestAuthParametersIsNull = false; } // determine if request.AuthParameters should be set to null if (requestAuthParametersIsNull) { request.AuthParameters = null; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } 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); }