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

            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.CoreNetworkId != null)
            {
                request.CoreNetworkId = cmdletContext.CoreNetworkId;
            }
            if (cmdletContext.EdgeLocation != null)
            {
                request.EdgeLocation = cmdletContext.EdgeLocation;
            }

            // populate Options
            var requestOptionsIsNull = true;

            request.Options = new Amazon.NetworkManager.Model.ConnectAttachmentOptions();
            Amazon.NetworkManager.TunnelProtocol requestOptions_options_Protocol = null;
            if (cmdletContext.Options_Protocol != null)
            {
                requestOptions_options_Protocol = cmdletContext.Options_Protocol;
            }
            if (requestOptions_options_Protocol != null)
            {
                request.Options.Protocol = requestOptions_options_Protocol;
                requestOptionsIsNull     = false;
            }
            // determine if request.Options should be set to null
            if (requestOptionsIsNull)
            {
                request.Options = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.TransportAttachmentId != null)
            {
                request.TransportAttachmentId = cmdletContext.TransportAttachmentId;
            }

            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);
        }