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


            // populate LifeCycle
            var requestLifeCycleIsNull = true;

            request.LifeCycle = new Amazon.Mgn.Model.ChangeServerLifeCycleStateSourceServerLifecycle();
            Amazon.Mgn.ChangeServerLifeCycleStateSourceServerLifecycleState requestLifeCycle_lifeCycle_State = null;
            if (cmdletContext.LifeCycle_State != null)
            {
                requestLifeCycle_lifeCycle_State = cmdletContext.LifeCycle_State;
            }
            if (requestLifeCycle_lifeCycle_State != null)
            {
                request.LifeCycle.State = requestLifeCycle_lifeCycle_State;
                requestLifeCycleIsNull  = false;
            }
            // determine if request.LifeCycle should be set to null
            if (requestLifeCycleIsNull)
            {
                request.LifeCycle = null;
            }
            if (cmdletContext.SourceServerID != null)
            {
                request.SourceServerID = cmdletContext.SourceServerID;
            }

            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.Mgn.Model.ChangeServerLifeCycleStateResponse CallAWSServiceOperation(IAmazonMgn client, Amazon.Mgn.Model.ChangeServerLifeCycleStateRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Application Migration Service", "ChangeServerLifeCycleState");
     try
     {
         #if DESKTOP
         return(client.ChangeServerLifeCycleState(request));
         #elif CORECLR
         return(client.ChangeServerLifeCycleStateAsync(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;
     }
 }