Ejemplo n.º 1
0
 private Amazon.AutoScalingPlans.Model.CreateScalingPlanResponse CallAWSServiceOperation(IAmazonAutoScalingPlans client, Amazon.AutoScalingPlans.Model.CreateScalingPlanRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Auto Scaling Plans", "CreateScalingPlan");
     try
     {
         #if DESKTOP
         return(client.CreateScalingPlan(request));
         #elif CORECLR
         return(client.CreateScalingPlanAsync(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;
     }
 }
Ejemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.AutoScalingPlans.Model.CreateScalingPlanRequest();


            // populate ApplicationSource
            var requestApplicationSourceIsNull = true;

            request.ApplicationSource = new Amazon.AutoScalingPlans.Model.ApplicationSource();
            System.String requestApplicationSource_applicationSource_CloudFormationStackARN = null;
            if (cmdletContext.ApplicationSource_CloudFormationStackARN != null)
            {
                requestApplicationSource_applicationSource_CloudFormationStackARN = cmdletContext.ApplicationSource_CloudFormationStackARN;
            }
            if (requestApplicationSource_applicationSource_CloudFormationStackARN != null)
            {
                request.ApplicationSource.CloudFormationStackARN = requestApplicationSource_applicationSource_CloudFormationStackARN;
                requestApplicationSourceIsNull = false;
            }
            List <Amazon.AutoScalingPlans.Model.TagFilter> requestApplicationSource_applicationSource_TagFilter = null;

            if (cmdletContext.ApplicationSource_TagFilter != null)
            {
                requestApplicationSource_applicationSource_TagFilter = cmdletContext.ApplicationSource_TagFilter;
            }
            if (requestApplicationSource_applicationSource_TagFilter != null)
            {
                request.ApplicationSource.TagFilters = requestApplicationSource_applicationSource_TagFilter;
                requestApplicationSourceIsNull       = false;
            }
            // determine if request.ApplicationSource should be set to null
            if (requestApplicationSourceIsNull)
            {
                request.ApplicationSource = null;
            }
            if (cmdletContext.ScalingInstruction != null)
            {
                request.ScalingInstructions = cmdletContext.ScalingInstruction;
            }
            if (cmdletContext.ScalingPlanName != null)
            {
                request.ScalingPlanName = cmdletContext.ScalingPlanName;
            }

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