public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.CreateTransitGatewayConnectRequest();


            // populate Options
            var requestOptionsIsNull = true;

            request.Options = new Amazon.EC2.Model.CreateTransitGatewayConnectRequestOptions();
            Amazon.EC2.ProtocolValue 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.TagSpecification != null)
            {
                request.TagSpecifications = cmdletContext.TagSpecification;
            }
            if (cmdletContext.TransportTransitGatewayAttachmentId != null)
            {
                request.TransportTransitGatewayAttachmentId = cmdletContext.TransportTransitGatewayAttachmentId;
            }

            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);
        }
 private Amazon.EC2.Model.CreateTransitGatewayConnectResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateTransitGatewayConnectRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateTransitGatewayConnect");
     try
     {
         #if DESKTOP
         return(client.CreateTransitGatewayConnect(request));
         #elif CORECLR
         return(client.CreateTransitGatewayConnectAsync(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;
     }
 }