Beispiel #1
0
 private Amazon.LicenseManager.Model.CreateLicenseConversionTaskForResourceResponse CallAWSServiceOperation(IAmazonLicenseManager client, Amazon.LicenseManager.Model.CreateLicenseConversionTaskForResourceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS License Manager", "CreateLicenseConversionTaskForResource");
     try
     {
         #if DESKTOP
         return(client.CreateLicenseConversionTaskForResource(request));
         #elif CORECLR
         return(client.CreateLicenseConversionTaskForResourceAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.LicenseManager.Model.CreateLicenseConversionTaskForResourceRequest();


            // populate DestinationLicenseContext
            var requestDestinationLicenseContextIsNull = true;

            request.DestinationLicenseContext = new Amazon.LicenseManager.Model.LicenseConversionContext();
            System.String requestDestinationLicenseContext_destinationLicenseContext_UsageOperation = null;
            if (cmdletContext.DestinationLicenseContext_UsageOperation != null)
            {
                requestDestinationLicenseContext_destinationLicenseContext_UsageOperation = cmdletContext.DestinationLicenseContext_UsageOperation;
            }
            if (requestDestinationLicenseContext_destinationLicenseContext_UsageOperation != null)
            {
                request.DestinationLicenseContext.UsageOperation = requestDestinationLicenseContext_destinationLicenseContext_UsageOperation;
                requestDestinationLicenseContextIsNull           = false;
            }
            // determine if request.DestinationLicenseContext should be set to null
            if (requestDestinationLicenseContextIsNull)
            {
                request.DestinationLicenseContext = null;
            }
            if (cmdletContext.ResourceArn != null)
            {
                request.ResourceArn = cmdletContext.ResourceArn;
            }

            // populate SourceLicenseContext
            var requestSourceLicenseContextIsNull = true;

            request.SourceLicenseContext = new Amazon.LicenseManager.Model.LicenseConversionContext();
            System.String requestSourceLicenseContext_sourceLicenseContext_UsageOperation = null;
            if (cmdletContext.SourceLicenseContext_UsageOperation != null)
            {
                requestSourceLicenseContext_sourceLicenseContext_UsageOperation = cmdletContext.SourceLicenseContext_UsageOperation;
            }
            if (requestSourceLicenseContext_sourceLicenseContext_UsageOperation != null)
            {
                request.SourceLicenseContext.UsageOperation = requestSourceLicenseContext_sourceLicenseContext_UsageOperation;
                requestSourceLicenseContextIsNull           = false;
            }
            // determine if request.SourceLicenseContext should be set to null
            if (requestSourceLicenseContextIsNull)
            {
                request.SourceLicenseContext = null;
            }

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