Beispiel #1
0
 private Amazon.Redshift.Model.CreateScheduledActionResponse CallAWSServiceOperation(IAmazonRedshift client, Amazon.Redshift.Model.CreateScheduledActionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Redshift", "CreateScheduledAction");
     try
     {
         #if DESKTOP
         return(client.CreateScheduledAction(request));
         #elif CORECLR
         return(client.CreateScheduledActionAsync(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.Redshift.Model.CreateScheduledActionRequest();

            if (cmdletContext.Enable != null)
            {
                request.Enable = cmdletContext.Enable.Value;
            }
            if (cmdletContext.EndTime != null)
            {
                request.EndTime = cmdletContext.EndTime.Value;
            }
            if (cmdletContext.IamRole != null)
            {
                request.IamRole = cmdletContext.IamRole;
            }
            if (cmdletContext.Schedule != null)
            {
                request.Schedule = cmdletContext.Schedule;
            }
            if (cmdletContext.ScheduledActionDescription != null)
            {
                request.ScheduledActionDescription = cmdletContext.ScheduledActionDescription;
            }
            if (cmdletContext.ScheduledActionName != null)
            {
                request.ScheduledActionName = cmdletContext.ScheduledActionName;
            }
            if (cmdletContext.StartTime != null)
            {
                request.StartTime = cmdletContext.StartTime.Value;
            }

            // populate TargetAction
            var requestTargetActionIsNull = true;

            request.TargetAction = new Amazon.Redshift.Model.ScheduledActionType();
            Amazon.Redshift.Model.PauseClusterMessage requestTargetAction_targetAction_PauseCluster = null;

            // populate PauseCluster
            var requestTargetAction_targetAction_PauseClusterIsNull = true;

            requestTargetAction_targetAction_PauseCluster = new Amazon.Redshift.Model.PauseClusterMessage();
            System.String requestTargetAction_targetAction_PauseCluster_pauseCluster_ClusterIdentifier = null;
            if (cmdletContext.PauseCluster_ClusterIdentifier != null)
            {
                requestTargetAction_targetAction_PauseCluster_pauseCluster_ClusterIdentifier = cmdletContext.PauseCluster_ClusterIdentifier;
            }
            if (requestTargetAction_targetAction_PauseCluster_pauseCluster_ClusterIdentifier != null)
            {
                requestTargetAction_targetAction_PauseCluster.ClusterIdentifier = requestTargetAction_targetAction_PauseCluster_pauseCluster_ClusterIdentifier;
                requestTargetAction_targetAction_PauseClusterIsNull             = false;
            }
            // determine if requestTargetAction_targetAction_PauseCluster should be set to null
            if (requestTargetAction_targetAction_PauseClusterIsNull)
            {
                requestTargetAction_targetAction_PauseCluster = null;
            }
            if (requestTargetAction_targetAction_PauseCluster != null)
            {
                request.TargetAction.PauseCluster = requestTargetAction_targetAction_PauseCluster;
                requestTargetActionIsNull         = false;
            }
            Amazon.Redshift.Model.ResumeClusterMessage requestTargetAction_targetAction_ResumeCluster = null;

            // populate ResumeCluster
            var requestTargetAction_targetAction_ResumeClusterIsNull = true;

            requestTargetAction_targetAction_ResumeCluster = new Amazon.Redshift.Model.ResumeClusterMessage();
            System.String requestTargetAction_targetAction_ResumeCluster_resumeCluster_ClusterIdentifier = null;
            if (cmdletContext.ResumeCluster_ClusterIdentifier != null)
            {
                requestTargetAction_targetAction_ResumeCluster_resumeCluster_ClusterIdentifier = cmdletContext.ResumeCluster_ClusterIdentifier;
            }
            if (requestTargetAction_targetAction_ResumeCluster_resumeCluster_ClusterIdentifier != null)
            {
                requestTargetAction_targetAction_ResumeCluster.ClusterIdentifier = requestTargetAction_targetAction_ResumeCluster_resumeCluster_ClusterIdentifier;
                requestTargetAction_targetAction_ResumeClusterIsNull             = false;
            }
            // determine if requestTargetAction_targetAction_ResumeCluster should be set to null
            if (requestTargetAction_targetAction_ResumeClusterIsNull)
            {
                requestTargetAction_targetAction_ResumeCluster = null;
            }
            if (requestTargetAction_targetAction_ResumeCluster != null)
            {
                request.TargetAction.ResumeCluster = requestTargetAction_targetAction_ResumeCluster;
                requestTargetActionIsNull          = false;
            }
            Amazon.Redshift.Model.ResizeClusterMessage requestTargetAction_targetAction_ResizeCluster = null;

            // populate ResizeCluster
            var requestTargetAction_targetAction_ResizeClusterIsNull = true;

            requestTargetAction_targetAction_ResizeCluster = new Amazon.Redshift.Model.ResizeClusterMessage();
            System.Boolean?requestTargetAction_targetAction_ResizeCluster_resizeCluster_Classic = null;
            if (cmdletContext.ResizeCluster_Classic != null)
            {
                requestTargetAction_targetAction_ResizeCluster_resizeCluster_Classic = cmdletContext.ResizeCluster_Classic.Value;
            }
            if (requestTargetAction_targetAction_ResizeCluster_resizeCluster_Classic != null)
            {
                requestTargetAction_targetAction_ResizeCluster.Classic = requestTargetAction_targetAction_ResizeCluster_resizeCluster_Classic.Value;
                requestTargetAction_targetAction_ResizeClusterIsNull   = false;
            }
            System.String requestTargetAction_targetAction_ResizeCluster_resizeCluster_ClusterIdentifier = null;
            if (cmdletContext.ResizeCluster_ClusterIdentifier != null)
            {
                requestTargetAction_targetAction_ResizeCluster_resizeCluster_ClusterIdentifier = cmdletContext.ResizeCluster_ClusterIdentifier;
            }
            if (requestTargetAction_targetAction_ResizeCluster_resizeCluster_ClusterIdentifier != null)
            {
                requestTargetAction_targetAction_ResizeCluster.ClusterIdentifier = requestTargetAction_targetAction_ResizeCluster_resizeCluster_ClusterIdentifier;
                requestTargetAction_targetAction_ResizeClusterIsNull             = false;
            }
            System.String requestTargetAction_targetAction_ResizeCluster_resizeCluster_ClusterType = null;
            if (cmdletContext.ResizeCluster_ClusterType != null)
            {
                requestTargetAction_targetAction_ResizeCluster_resizeCluster_ClusterType = cmdletContext.ResizeCluster_ClusterType;
            }
            if (requestTargetAction_targetAction_ResizeCluster_resizeCluster_ClusterType != null)
            {
                requestTargetAction_targetAction_ResizeCluster.ClusterType = requestTargetAction_targetAction_ResizeCluster_resizeCluster_ClusterType;
                requestTargetAction_targetAction_ResizeClusterIsNull       = false;
            }
            System.String requestTargetAction_targetAction_ResizeCluster_resizeCluster_NodeType = null;
            if (cmdletContext.ResizeCluster_NodeType != null)
            {
                requestTargetAction_targetAction_ResizeCluster_resizeCluster_NodeType = cmdletContext.ResizeCluster_NodeType;
            }
            if (requestTargetAction_targetAction_ResizeCluster_resizeCluster_NodeType != null)
            {
                requestTargetAction_targetAction_ResizeCluster.NodeType = requestTargetAction_targetAction_ResizeCluster_resizeCluster_NodeType;
                requestTargetAction_targetAction_ResizeClusterIsNull    = false;
            }
            System.Int32?requestTargetAction_targetAction_ResizeCluster_resizeCluster_NumberOfNode = null;
            if (cmdletContext.ResizeCluster_NumberOfNode != null)
            {
                requestTargetAction_targetAction_ResizeCluster_resizeCluster_NumberOfNode = cmdletContext.ResizeCluster_NumberOfNode.Value;
            }
            if (requestTargetAction_targetAction_ResizeCluster_resizeCluster_NumberOfNode != null)
            {
                requestTargetAction_targetAction_ResizeCluster.NumberOfNodes = requestTargetAction_targetAction_ResizeCluster_resizeCluster_NumberOfNode.Value;
                requestTargetAction_targetAction_ResizeClusterIsNull         = false;
            }
            // determine if requestTargetAction_targetAction_ResizeCluster should be set to null
            if (requestTargetAction_targetAction_ResizeClusterIsNull)
            {
                requestTargetAction_targetAction_ResizeCluster = null;
            }
            if (requestTargetAction_targetAction_ResizeCluster != null)
            {
                request.TargetAction.ResizeCluster = requestTargetAction_targetAction_ResizeCluster;
                requestTargetActionIsNull          = false;
            }
            // determine if request.TargetAction should be set to null
            if (requestTargetActionIsNull)
            {
                request.TargetAction = 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);
        }