Beispiel #1
0
 private Amazon.CodePipeline.Model.PutWebhookResponse CallAWSServiceOperation(IAmazonCodePipeline client, Amazon.CodePipeline.Model.PutWebhookRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CodePipeline", "PutWebhook");
     try
     {
         #if DESKTOP
         return(client.PutWebhook(request));
         #elif CORECLR
         return(client.PutWebhookAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CodePipeline.Model.PutWebhookRequest();

            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            // populate Webhook
            var requestWebhookIsNull = true;

            request.Webhook = new Amazon.CodePipeline.Model.WebhookDefinition();
            Amazon.CodePipeline.WebhookAuthenticationType requestWebhook_webhook_Authentication = null;
            if (cmdletContext.Webhook_Authentication != null)
            {
                requestWebhook_webhook_Authentication = cmdletContext.Webhook_Authentication;
            }
            if (requestWebhook_webhook_Authentication != null)
            {
                request.Webhook.Authentication = requestWebhook_webhook_Authentication;
                requestWebhookIsNull           = false;
            }
            List <Amazon.CodePipeline.Model.WebhookFilterRule> requestWebhook_webhook_Filter = null;

            if (cmdletContext.Webhook_Filter != null)
            {
                requestWebhook_webhook_Filter = cmdletContext.Webhook_Filter;
            }
            if (requestWebhook_webhook_Filter != null)
            {
                request.Webhook.Filters = requestWebhook_webhook_Filter;
                requestWebhookIsNull    = false;
            }
            System.String requestWebhook_webhook_Name = null;
            if (cmdletContext.Webhook_Name != null)
            {
                requestWebhook_webhook_Name = cmdletContext.Webhook_Name;
            }
            if (requestWebhook_webhook_Name != null)
            {
                request.Webhook.Name = requestWebhook_webhook_Name;
                requestWebhookIsNull = false;
            }
            System.String requestWebhook_webhook_TargetAction = null;
            if (cmdletContext.Webhook_TargetAction != null)
            {
                requestWebhook_webhook_TargetAction = cmdletContext.Webhook_TargetAction;
            }
            if (requestWebhook_webhook_TargetAction != null)
            {
                request.Webhook.TargetAction = requestWebhook_webhook_TargetAction;
                requestWebhookIsNull         = false;
            }
            System.String requestWebhook_webhook_TargetPipeline = null;
            if (cmdletContext.Webhook_TargetPipeline != null)
            {
                requestWebhook_webhook_TargetPipeline = cmdletContext.Webhook_TargetPipeline;
            }
            if (requestWebhook_webhook_TargetPipeline != null)
            {
                request.Webhook.TargetPipeline = requestWebhook_webhook_TargetPipeline;
                requestWebhookIsNull           = false;
            }
            Amazon.CodePipeline.Model.WebhookAuthConfiguration requestWebhook_webhook_AuthenticationConfiguration = null;

            // populate AuthenticationConfiguration
            var requestWebhook_webhook_AuthenticationConfigurationIsNull = true;

            requestWebhook_webhook_AuthenticationConfiguration = new Amazon.CodePipeline.Model.WebhookAuthConfiguration();
            System.String requestWebhook_webhook_AuthenticationConfiguration_authenticationConfiguration_AllowedIPRange = null;
            if (cmdletContext.AuthenticationConfiguration_AllowedIPRange != null)
            {
                requestWebhook_webhook_AuthenticationConfiguration_authenticationConfiguration_AllowedIPRange = cmdletContext.AuthenticationConfiguration_AllowedIPRange;
            }
            if (requestWebhook_webhook_AuthenticationConfiguration_authenticationConfiguration_AllowedIPRange != null)
            {
                requestWebhook_webhook_AuthenticationConfiguration.AllowedIPRange = requestWebhook_webhook_AuthenticationConfiguration_authenticationConfiguration_AllowedIPRange;
                requestWebhook_webhook_AuthenticationConfigurationIsNull          = false;
            }
            System.String requestWebhook_webhook_AuthenticationConfiguration_authenticationConfiguration_SecretToken = null;
            if (cmdletContext.AuthenticationConfiguration_SecretToken != null)
            {
                requestWebhook_webhook_AuthenticationConfiguration_authenticationConfiguration_SecretToken = cmdletContext.AuthenticationConfiguration_SecretToken;
            }
            if (requestWebhook_webhook_AuthenticationConfiguration_authenticationConfiguration_SecretToken != null)
            {
                requestWebhook_webhook_AuthenticationConfiguration.SecretToken = requestWebhook_webhook_AuthenticationConfiguration_authenticationConfiguration_SecretToken;
                requestWebhook_webhook_AuthenticationConfigurationIsNull       = false;
            }
            // determine if requestWebhook_webhook_AuthenticationConfiguration should be set to null
            if (requestWebhook_webhook_AuthenticationConfigurationIsNull)
            {
                requestWebhook_webhook_AuthenticationConfiguration = null;
            }
            if (requestWebhook_webhook_AuthenticationConfiguration != null)
            {
                request.Webhook.AuthenticationConfiguration = requestWebhook_webhook_AuthenticationConfiguration;
                requestWebhookIsNull = false;
            }
            // determine if request.Webhook should be set to null
            if (requestWebhookIsNull)
            {
                request.Webhook = null;
            }

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