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


            // populate Bandwidth
            var requestBandwidthIsNull = true;

            request.Bandwidth = new Amazon.NetworkManager.Model.Bandwidth();
            System.Int32?requestBandwidth_bandwidth_DownloadSpeed = null;
            if (cmdletContext.Bandwidth_DownloadSpeed != null)
            {
                requestBandwidth_bandwidth_DownloadSpeed = cmdletContext.Bandwidth_DownloadSpeed.Value;
            }
            if (requestBandwidth_bandwidth_DownloadSpeed != null)
            {
                request.Bandwidth.DownloadSpeed = requestBandwidth_bandwidth_DownloadSpeed.Value;
                requestBandwidthIsNull          = false;
            }
            System.Int32?requestBandwidth_bandwidth_UploadSpeed = null;
            if (cmdletContext.Bandwidth_UploadSpeed != null)
            {
                requestBandwidth_bandwidth_UploadSpeed = cmdletContext.Bandwidth_UploadSpeed.Value;
            }
            if (requestBandwidth_bandwidth_UploadSpeed != null)
            {
                request.Bandwidth.UploadSpeed = requestBandwidth_bandwidth_UploadSpeed.Value;
                requestBandwidthIsNull        = false;
            }
            // determine if request.Bandwidth should be set to null
            if (requestBandwidthIsNull)
            {
                request.Bandwidth = null;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.GlobalNetworkId != null)
            {
                request.GlobalNetworkId = cmdletContext.GlobalNetworkId;
            }
            if (cmdletContext.Provider != null)
            {
                request.Provider = cmdletContext.Provider;
            }
            if (cmdletContext.SiteId != null)
            {
                request.SiteId = cmdletContext.SiteId;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.Type != null)
            {
                request.Type = cmdletContext.Type;
            }

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