private Amazon.NetworkManager.Model.CreateConnectPeerResponse CallAWSServiceOperation(IAmazonNetworkManager client, Amazon.NetworkManager.Model.CreateConnectPeerRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Network Manager", "CreateConnectPeer");
     try
     {
         #if DESKTOP
         return(client.CreateConnectPeer(request));
         #elif CORECLR
         return(client.CreateConnectPeerAsync(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.NetworkManager.Model.CreateConnectPeerRequest();


            // populate BgpOptions
            var requestBgpOptionsIsNull = true;

            request.BgpOptions = new Amazon.NetworkManager.Model.BgpOptions();
            System.Int64?requestBgpOptions_bgpOptions_PeerAsn = null;
            if (cmdletContext.BgpOptions_PeerAsn != null)
            {
                requestBgpOptions_bgpOptions_PeerAsn = cmdletContext.BgpOptions_PeerAsn.Value;
            }
            if (requestBgpOptions_bgpOptions_PeerAsn != null)
            {
                request.BgpOptions.PeerAsn = requestBgpOptions_bgpOptions_PeerAsn.Value;
                requestBgpOptionsIsNull    = false;
            }
            // determine if request.BgpOptions should be set to null
            if (requestBgpOptionsIsNull)
            {
                request.BgpOptions = null;
            }
            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.ConnectAttachmentId != null)
            {
                request.ConnectAttachmentId = cmdletContext.ConnectAttachmentId;
            }
            if (cmdletContext.CoreNetworkAddress != null)
            {
                request.CoreNetworkAddress = cmdletContext.CoreNetworkAddress;
            }
            if (cmdletContext.InsideCidrBlock != null)
            {
                request.InsideCidrBlocks = cmdletContext.InsideCidrBlock;
            }
            if (cmdletContext.PeerAddress != null)
            {
                request.PeerAddress = cmdletContext.PeerAddress;
            }
            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);
        }