private Amazon.Pinpoint.Model.UpdateEmailTemplateResponse CallAWSServiceOperation(IAmazonPinpoint client, Amazon.Pinpoint.Model.UpdateEmailTemplateRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Pinpoint", "UpdateEmailTemplate"); try { #if DESKTOP return(client.UpdateEmailTemplate(request)); #elif CORECLR return(client.UpdateEmailTemplateAsync(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.Pinpoint.Model.UpdateEmailTemplateRequest(); // populate EmailTemplateRequest var requestEmailTemplateRequestIsNull = true; request.EmailTemplateRequest = new Amazon.Pinpoint.Model.EmailTemplateRequest(); System.String requestEmailTemplateRequest_emailTemplateRequest_DefaultSubstitution = null; if (cmdletContext.EmailTemplateRequest_DefaultSubstitution != null) { requestEmailTemplateRequest_emailTemplateRequest_DefaultSubstitution = cmdletContext.EmailTemplateRequest_DefaultSubstitution; } if (requestEmailTemplateRequest_emailTemplateRequest_DefaultSubstitution != null) { request.EmailTemplateRequest.DefaultSubstitutions = requestEmailTemplateRequest_emailTemplateRequest_DefaultSubstitution; requestEmailTemplateRequestIsNull = false; } System.String requestEmailTemplateRequest_emailTemplateRequest_HtmlPart = null; if (cmdletContext.EmailTemplateRequest_HtmlPart != null) { requestEmailTemplateRequest_emailTemplateRequest_HtmlPart = cmdletContext.EmailTemplateRequest_HtmlPart; } if (requestEmailTemplateRequest_emailTemplateRequest_HtmlPart != null) { request.EmailTemplateRequest.HtmlPart = requestEmailTemplateRequest_emailTemplateRequest_HtmlPart; requestEmailTemplateRequestIsNull = false; } System.String requestEmailTemplateRequest_emailTemplateRequest_Subject = null; if (cmdletContext.EmailTemplateRequest_Subject != null) { requestEmailTemplateRequest_emailTemplateRequest_Subject = cmdletContext.EmailTemplateRequest_Subject; } if (requestEmailTemplateRequest_emailTemplateRequest_Subject != null) { request.EmailTemplateRequest.Subject = requestEmailTemplateRequest_emailTemplateRequest_Subject; requestEmailTemplateRequestIsNull = false; } Dictionary <System.String, System.String> requestEmailTemplateRequest_emailTemplateRequest_Tag = null; if (cmdletContext.EmailTemplateRequest_Tag != null) { requestEmailTemplateRequest_emailTemplateRequest_Tag = cmdletContext.EmailTemplateRequest_Tag; } if (requestEmailTemplateRequest_emailTemplateRequest_Tag != null) { request.EmailTemplateRequest.Tags = requestEmailTemplateRequest_emailTemplateRequest_Tag; requestEmailTemplateRequestIsNull = false; } System.String requestEmailTemplateRequest_emailTemplateRequest_TemplateDescription = null; if (cmdletContext.EmailTemplateRequest_TemplateDescription != null) { requestEmailTemplateRequest_emailTemplateRequest_TemplateDescription = cmdletContext.EmailTemplateRequest_TemplateDescription; } if (requestEmailTemplateRequest_emailTemplateRequest_TemplateDescription != null) { request.EmailTemplateRequest.TemplateDescription = requestEmailTemplateRequest_emailTemplateRequest_TemplateDescription; requestEmailTemplateRequestIsNull = false; } System.String requestEmailTemplateRequest_emailTemplateRequest_TextPart = null; if (cmdletContext.EmailTemplateRequest_TextPart != null) { requestEmailTemplateRequest_emailTemplateRequest_TextPart = cmdletContext.EmailTemplateRequest_TextPart; } if (requestEmailTemplateRequest_emailTemplateRequest_TextPart != null) { request.EmailTemplateRequest.TextPart = requestEmailTemplateRequest_emailTemplateRequest_TextPart; requestEmailTemplateRequestIsNull = false; } // determine if request.EmailTemplateRequest should be set to null if (requestEmailTemplateRequestIsNull) { request.EmailTemplateRequest = 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); }