private Amazon.Drs.Model.CreateReplicationConfigurationTemplateResponse CallAWSServiceOperation(IAmazonDrs client, Amazon.Drs.Model.CreateReplicationConfigurationTemplateRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Elastic Disaster Recovery Service", "CreateReplicationConfigurationTemplate"); try { #if DESKTOP return(client.CreateReplicationConfigurationTemplate(request)); #elif CORECLR return(client.CreateReplicationConfigurationTemplateAsync(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.Drs.Model.CreateReplicationConfigurationTemplateRequest(); if (cmdletContext.AssociateDefaultSecurityGroup != null) { request.AssociateDefaultSecurityGroup = cmdletContext.AssociateDefaultSecurityGroup.Value; } if (cmdletContext.BandwidthThrottling != null) { request.BandwidthThrottling = cmdletContext.BandwidthThrottling.Value; } if (cmdletContext.CreatePublicIP != null) { request.CreatePublicIP = cmdletContext.CreatePublicIP.Value; } if (cmdletContext.DataPlaneRouting != null) { request.DataPlaneRouting = cmdletContext.DataPlaneRouting; } if (cmdletContext.DefaultLargeStagingDiskType != null) { request.DefaultLargeStagingDiskType = cmdletContext.DefaultLargeStagingDiskType; } if (cmdletContext.EbsEncryption != null) { request.EbsEncryption = cmdletContext.EbsEncryption; } if (cmdletContext.EbsEncryptionKeyArn != null) { request.EbsEncryptionKeyArn = cmdletContext.EbsEncryptionKeyArn; } if (cmdletContext.PitPolicy != null) { request.PitPolicy = cmdletContext.PitPolicy; } if (cmdletContext.ReplicationServerInstanceType != null) { request.ReplicationServerInstanceType = cmdletContext.ReplicationServerInstanceType; } if (cmdletContext.ReplicationServersSecurityGroupsIDs != null) { request.ReplicationServersSecurityGroupsIDs = cmdletContext.ReplicationServersSecurityGroupsIDs; } if (cmdletContext.StagingAreaSubnetId != null) { request.StagingAreaSubnetId = cmdletContext.StagingAreaSubnetId; } if (cmdletContext.StagingAreaTag != null) { request.StagingAreaTags = cmdletContext.StagingAreaTag; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.UseDedicatedReplicationServer != null) { request.UseDedicatedReplicationServer = cmdletContext.UseDedicatedReplicationServer.Value; } 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); }