Exemplo n.º 1
0
 private Amazon.EKS.Model.UpdateNodegroupConfigResponse CallAWSServiceOperation(IAmazonEKS client, Amazon.EKS.Model.UpdateNodegroupConfigRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Container Service for Kubernetes", "UpdateNodegroupConfig");
     try
     {
         #if DESKTOP
         return(client.UpdateNodegroupConfig(request));
         #elif CORECLR
         return(client.UpdateNodegroupConfigAsync(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;
     }
 }
Exemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EKS.Model.UpdateNodegroupConfigRequest();

            if (cmdletContext.ClientRequestToken != null)
            {
                request.ClientRequestToken = cmdletContext.ClientRequestToken;
            }
            if (cmdletContext.ClusterName != null)
            {
                request.ClusterName = cmdletContext.ClusterName;
            }

            // populate Labels
            var requestLabelsIsNull = true;

            request.Labels = new Amazon.EKS.Model.UpdateLabelsPayload();
            Dictionary <System.String, System.String> requestLabels_labels_AddOrUpdateLabel = null;

            if (cmdletContext.Labels_AddOrUpdateLabel != null)
            {
                requestLabels_labels_AddOrUpdateLabel = cmdletContext.Labels_AddOrUpdateLabel;
            }
            if (requestLabels_labels_AddOrUpdateLabel != null)
            {
                request.Labels.AddOrUpdateLabels = requestLabels_labels_AddOrUpdateLabel;
                requestLabelsIsNull = false;
            }
            List <System.String> requestLabels_labels_RemoveLabel = null;

            if (cmdletContext.Labels_RemoveLabel != null)
            {
                requestLabels_labels_RemoveLabel = cmdletContext.Labels_RemoveLabel;
            }
            if (requestLabels_labels_RemoveLabel != null)
            {
                request.Labels.RemoveLabels = requestLabels_labels_RemoveLabel;
                requestLabelsIsNull         = false;
            }
            // determine if request.Labels should be set to null
            if (requestLabelsIsNull)
            {
                request.Labels = null;
            }
            if (cmdletContext.NodegroupName != null)
            {
                request.NodegroupName = cmdletContext.NodegroupName;
            }

            // populate ScalingConfig
            var requestScalingConfigIsNull = true;

            request.ScalingConfig = new Amazon.EKS.Model.NodegroupScalingConfig();
            System.Int32?requestScalingConfig_scalingConfig_DesiredSize = null;
            if (cmdletContext.ScalingConfig_DesiredSize != null)
            {
                requestScalingConfig_scalingConfig_DesiredSize = cmdletContext.ScalingConfig_DesiredSize.Value;
            }
            if (requestScalingConfig_scalingConfig_DesiredSize != null)
            {
                request.ScalingConfig.DesiredSize = requestScalingConfig_scalingConfig_DesiredSize.Value;
                requestScalingConfigIsNull        = false;
            }
            System.Int32?requestScalingConfig_scalingConfig_MaxSize = null;
            if (cmdletContext.ScalingConfig_MaxSize != null)
            {
                requestScalingConfig_scalingConfig_MaxSize = cmdletContext.ScalingConfig_MaxSize.Value;
            }
            if (requestScalingConfig_scalingConfig_MaxSize != null)
            {
                request.ScalingConfig.MaxSize = requestScalingConfig_scalingConfig_MaxSize.Value;
                requestScalingConfigIsNull    = false;
            }
            System.Int32?requestScalingConfig_scalingConfig_MinSize = null;
            if (cmdletContext.ScalingConfig_MinSize != null)
            {
                requestScalingConfig_scalingConfig_MinSize = cmdletContext.ScalingConfig_MinSize.Value;
            }
            if (requestScalingConfig_scalingConfig_MinSize != null)
            {
                request.ScalingConfig.MinSize = requestScalingConfig_scalingConfig_MinSize.Value;
                requestScalingConfigIsNull    = false;
            }
            // determine if request.ScalingConfig should be set to null
            if (requestScalingConfigIsNull)
            {
                request.ScalingConfig = 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);
        }