Exemple #1
0
 private Amazon.Pinpoint.Model.CreateSmsTemplateResponse CallAWSServiceOperation(IAmazonPinpoint client, Amazon.Pinpoint.Model.CreateSmsTemplateRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Pinpoint", "CreateSmsTemplate");
     try
     {
         #if DESKTOP
         return(client.CreateSmsTemplate(request));
         #elif CORECLR
         return(client.CreateSmsTemplateAsync(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;
     }
 }
Exemple #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Pinpoint.Model.CreateSmsTemplateRequest();


            // populate SMSTemplateRequest
            var requestSMSTemplateRequestIsNull = true;

            request.SMSTemplateRequest = new Amazon.Pinpoint.Model.SMSTemplateRequest();
            System.String requestSMSTemplateRequest_sMSTemplateRequest_Body = null;
            if (cmdletContext.SMSTemplateRequest_Body != null)
            {
                requestSMSTemplateRequest_sMSTemplateRequest_Body = cmdletContext.SMSTemplateRequest_Body;
            }
            if (requestSMSTemplateRequest_sMSTemplateRequest_Body != null)
            {
                request.SMSTemplateRequest.Body = requestSMSTemplateRequest_sMSTemplateRequest_Body;
                requestSMSTemplateRequestIsNull = false;
            }
            System.String requestSMSTemplateRequest_sMSTemplateRequest_DefaultSubstitution = null;
            if (cmdletContext.SMSTemplateRequest_DefaultSubstitution != null)
            {
                requestSMSTemplateRequest_sMSTemplateRequest_DefaultSubstitution = cmdletContext.SMSTemplateRequest_DefaultSubstitution;
            }
            if (requestSMSTemplateRequest_sMSTemplateRequest_DefaultSubstitution != null)
            {
                request.SMSTemplateRequest.DefaultSubstitutions = requestSMSTemplateRequest_sMSTemplateRequest_DefaultSubstitution;
                requestSMSTemplateRequestIsNull = false;
            }
            Dictionary <System.String, System.String> requestSMSTemplateRequest_sMSTemplateRequest_Tag = null;

            if (cmdletContext.SMSTemplateRequest_Tag != null)
            {
                requestSMSTemplateRequest_sMSTemplateRequest_Tag = cmdletContext.SMSTemplateRequest_Tag;
            }
            if (requestSMSTemplateRequest_sMSTemplateRequest_Tag != null)
            {
                request.SMSTemplateRequest.Tags = requestSMSTemplateRequest_sMSTemplateRequest_Tag;
                requestSMSTemplateRequestIsNull = false;
            }
            System.String requestSMSTemplateRequest_sMSTemplateRequest_TemplateDescription = null;
            if (cmdletContext.SMSTemplateRequest_TemplateDescription != null)
            {
                requestSMSTemplateRequest_sMSTemplateRequest_TemplateDescription = cmdletContext.SMSTemplateRequest_TemplateDescription;
            }
            if (requestSMSTemplateRequest_sMSTemplateRequest_TemplateDescription != null)
            {
                request.SMSTemplateRequest.TemplateDescription = requestSMSTemplateRequest_sMSTemplateRequest_TemplateDescription;
                requestSMSTemplateRequestIsNull = false;
            }
            // determine if request.SMSTemplateRequest should be set to null
            if (requestSMSTemplateRequestIsNull)
            {
                request.SMSTemplateRequest = null;
            }
            if (cmdletContext.TemplateName != null)
            {
                request.TemplateName = cmdletContext.TemplateName;
            }

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