public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.KeyManagementService.Model.CreateCustomKeyStoreRequest(); if (cmdletContext.CloudHsmClusterId != null) { request.CloudHsmClusterId = cmdletContext.CloudHsmClusterId; } if (cmdletContext.CustomKeyStoreName != null) { request.CustomKeyStoreName = cmdletContext.CustomKeyStoreName; } if (cmdletContext.KeyStorePassword != null) { request.KeyStorePassword = cmdletContext.KeyStorePassword; } if (cmdletContext.TrustAnchorCertificate != null) { request.TrustAnchorCertificate = cmdletContext.TrustAnchorCertificate; } 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.KeyManagementService.Model.CreateCustomKeyStoreResponse CallAWSServiceOperation(IAmazonKeyManagementService client, Amazon.KeyManagementService.Model.CreateCustomKeyStoreRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Key Management Service", "CreateCustomKeyStore"); try { #if DESKTOP return(client.CreateCustomKeyStore(request)); #elif CORECLR return(client.CreateCustomKeyStoreAsync(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; } }