コード例 #1
0
 private Amazon.NetworkManager.Model.UpdateLinkResponse CallAWSServiceOperation(IAmazonNetworkManager client, Amazon.NetworkManager.Model.UpdateLinkRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Network Manager", "UpdateLink");
     try
     {
         #if DESKTOP
         return(client.UpdateLink(request));
         #elif CORECLR
         return(client.UpdateLinkAsync(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;
     }
 }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.NetworkManager.Model.UpdateLinkRequest();


            // 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.LinkId != null)
            {
                request.LinkId = cmdletContext.LinkId;
            }
            if (cmdletContext.Provider != null)
            {
                request.Provider = cmdletContext.Provider;
            }
            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);
        }