public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.SimpleEmailV2.Model.CreateEmailIdentityRequest(); if (cmdletContext.EmailIdentity != null) { request.EmailIdentity = cmdletContext.EmailIdentity; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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.SimpleEmailV2.Model.CreateEmailIdentityResponse CallAWSServiceOperation(IAmazonSimpleEmailServiceV2 client, Amazon.SimpleEmailV2.Model.CreateEmailIdentityRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Email Service V2 (SES V2)", "CreateEmailIdentity"); try { #if DESKTOP return(client.CreateEmailIdentity(request)); #elif CORECLR return(client.CreateEmailIdentityAsync(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.SimpleEmailV2.Model.CreateEmailIdentityRequest(); if (cmdletContext.ConfigurationSetName != null) { request.ConfigurationSetName = cmdletContext.ConfigurationSetName; } // populate DkimSigningAttributes var requestDkimSigningAttributesIsNull = true; request.DkimSigningAttributes = new Amazon.SimpleEmailV2.Model.DkimSigningAttributes(); System.String requestDkimSigningAttributes_dkimSigningAttributes_DomainSigningPrivateKey = null; if (cmdletContext.DkimSigningAttributes_DomainSigningPrivateKey != null) { requestDkimSigningAttributes_dkimSigningAttributes_DomainSigningPrivateKey = cmdletContext.DkimSigningAttributes_DomainSigningPrivateKey; } if (requestDkimSigningAttributes_dkimSigningAttributes_DomainSigningPrivateKey != null) { request.DkimSigningAttributes.DomainSigningPrivateKey = requestDkimSigningAttributes_dkimSigningAttributes_DomainSigningPrivateKey; requestDkimSigningAttributesIsNull = false; } System.String requestDkimSigningAttributes_dkimSigningAttributes_DomainSigningSelector = null; if (cmdletContext.DkimSigningAttributes_DomainSigningSelector != null) { requestDkimSigningAttributes_dkimSigningAttributes_DomainSigningSelector = cmdletContext.DkimSigningAttributes_DomainSigningSelector; } if (requestDkimSigningAttributes_dkimSigningAttributes_DomainSigningSelector != null) { request.DkimSigningAttributes.DomainSigningSelector = requestDkimSigningAttributes_dkimSigningAttributes_DomainSigningSelector; requestDkimSigningAttributesIsNull = false; } // determine if request.DkimSigningAttributes should be set to null if (requestDkimSigningAttributesIsNull) { request.DkimSigningAttributes = null; } if (cmdletContext.EmailIdentity != null) { request.EmailIdentity = cmdletContext.EmailIdentity; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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); }