private Amazon.DataSync.Model.CreateLocationEfsResponse CallAWSServiceOperation(IAmazonDataSync client, Amazon.DataSync.Model.CreateLocationEfsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS DataSync", "CreateLocationEfs"); try { #if DESKTOP return(client.CreateLocationEfs(request)); #elif CORECLR return(client.CreateLocationEfsAsync(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.DataSync.Model.CreateLocationEfsRequest(); // populate Ec2Config var requestEc2ConfigIsNull = true; request.Ec2Config = new Amazon.DataSync.Model.Ec2Config(); List <System.String> requestEc2Config_ec2Config_SecurityGroupArn = null; if (cmdletContext.Ec2Config_SecurityGroupArn != null) { requestEc2Config_ec2Config_SecurityGroupArn = cmdletContext.Ec2Config_SecurityGroupArn; } if (requestEc2Config_ec2Config_SecurityGroupArn != null) { request.Ec2Config.SecurityGroupArns = requestEc2Config_ec2Config_SecurityGroupArn; requestEc2ConfigIsNull = false; } System.String requestEc2Config_ec2Config_SubnetArn = null; if (cmdletContext.Ec2Config_SubnetArn != null) { requestEc2Config_ec2Config_SubnetArn = cmdletContext.Ec2Config_SubnetArn; } if (requestEc2Config_ec2Config_SubnetArn != null) { request.Ec2Config.SubnetArn = requestEc2Config_ec2Config_SubnetArn; requestEc2ConfigIsNull = false; } // determine if request.Ec2Config should be set to null if (requestEc2ConfigIsNull) { request.Ec2Config = null; } if (cmdletContext.EfsFilesystemArn != null) { request.EfsFilesystemArn = cmdletContext.EfsFilesystemArn; } if (cmdletContext.Subdirectory != null) { request.Subdirectory = cmdletContext.Subdirectory; } 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); }