private Amazon.EC2.Model.ProvisionByoipCidrResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.ProvisionByoipCidrRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "ProvisionByoipCidr"); try { #if DESKTOP return(client.ProvisionByoipCidr(request)); #elif CORECLR return(client.ProvisionByoipCidrAsync(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.EC2.Model.ProvisionByoipCidrRequest(); if (cmdletContext.Cidr != null) { request.Cidr = cmdletContext.Cidr; } // populate CidrAuthorizationContext var requestCidrAuthorizationContextIsNull = true; request.CidrAuthorizationContext = new Amazon.EC2.Model.CidrAuthorizationContext(); System.String requestCidrAuthorizationContext_cidrAuthorizationContext_Message = null; if (cmdletContext.CidrAuthorizationContext_Message != null) { requestCidrAuthorizationContext_cidrAuthorizationContext_Message = cmdletContext.CidrAuthorizationContext_Message; } if (requestCidrAuthorizationContext_cidrAuthorizationContext_Message != null) { request.CidrAuthorizationContext.Message = requestCidrAuthorizationContext_cidrAuthorizationContext_Message; requestCidrAuthorizationContextIsNull = false; } System.String requestCidrAuthorizationContext_cidrAuthorizationContext_Signature = null; if (cmdletContext.CidrAuthorizationContext_Signature != null) { requestCidrAuthorizationContext_cidrAuthorizationContext_Signature = cmdletContext.CidrAuthorizationContext_Signature; } if (requestCidrAuthorizationContext_cidrAuthorizationContext_Signature != null) { request.CidrAuthorizationContext.Signature = requestCidrAuthorizationContext_cidrAuthorizationContext_Signature; requestCidrAuthorizationContextIsNull = false; } // determine if request.CidrAuthorizationContext should be set to null if (requestCidrAuthorizationContextIsNull) { request.CidrAuthorizationContext = null; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } 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); }