Exemplo n.º 1
0
 private Amazon.KafkaConnect.Model.UpdateConnectorResponse CallAWSServiceOperation(IAmazonKafkaConnect client, Amazon.KafkaConnect.Model.UpdateConnectorRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Managed Streaming for Kafka Connect", "UpdateConnector");
     try
     {
         #if DESKTOP
         return(client.UpdateConnector(request));
         #elif CORECLR
         return(client.UpdateConnectorAsync(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.KafkaConnect.Model.UpdateConnectorRequest();


            // populate Capacity
            var requestCapacityIsNull = true;

            request.Capacity = new Amazon.KafkaConnect.Model.CapacityUpdate();
            Amazon.KafkaConnect.Model.ProvisionedCapacityUpdate requestCapacity_capacity_ProvisionedCapacity = null;

            // populate ProvisionedCapacity
            var requestCapacity_capacity_ProvisionedCapacityIsNull = true;

            requestCapacity_capacity_ProvisionedCapacity = new Amazon.KafkaConnect.Model.ProvisionedCapacityUpdate();
            System.Int32?requestCapacity_capacity_ProvisionedCapacity_provisionedCapacity_McuCount = null;
            if (cmdletContext.ProvisionedCapacity_McuCount != null)
            {
                requestCapacity_capacity_ProvisionedCapacity_provisionedCapacity_McuCount = cmdletContext.ProvisionedCapacity_McuCount.Value;
            }
            if (requestCapacity_capacity_ProvisionedCapacity_provisionedCapacity_McuCount != null)
            {
                requestCapacity_capacity_ProvisionedCapacity.McuCount = requestCapacity_capacity_ProvisionedCapacity_provisionedCapacity_McuCount.Value;
                requestCapacity_capacity_ProvisionedCapacityIsNull    = false;
            }
            System.Int32?requestCapacity_capacity_ProvisionedCapacity_provisionedCapacity_WorkerCount = null;
            if (cmdletContext.ProvisionedCapacity_WorkerCount != null)
            {
                requestCapacity_capacity_ProvisionedCapacity_provisionedCapacity_WorkerCount = cmdletContext.ProvisionedCapacity_WorkerCount.Value;
            }
            if (requestCapacity_capacity_ProvisionedCapacity_provisionedCapacity_WorkerCount != null)
            {
                requestCapacity_capacity_ProvisionedCapacity.WorkerCount = requestCapacity_capacity_ProvisionedCapacity_provisionedCapacity_WorkerCount.Value;
                requestCapacity_capacity_ProvisionedCapacityIsNull       = false;
            }
            // determine if requestCapacity_capacity_ProvisionedCapacity should be set to null
            if (requestCapacity_capacity_ProvisionedCapacityIsNull)
            {
                requestCapacity_capacity_ProvisionedCapacity = null;
            }
            if (requestCapacity_capacity_ProvisionedCapacity != null)
            {
                request.Capacity.ProvisionedCapacity = requestCapacity_capacity_ProvisionedCapacity;
                requestCapacityIsNull = false;
            }
            Amazon.KafkaConnect.Model.AutoScalingUpdate requestCapacity_capacity_AutoScaling = null;

            // populate AutoScaling
            var requestCapacity_capacity_AutoScalingIsNull = true;

            requestCapacity_capacity_AutoScaling = new Amazon.KafkaConnect.Model.AutoScalingUpdate();
            System.Int32?requestCapacity_capacity_AutoScaling_autoScaling_MaxWorkerCount = null;
            if (cmdletContext.AutoScaling_MaxWorkerCount != null)
            {
                requestCapacity_capacity_AutoScaling_autoScaling_MaxWorkerCount = cmdletContext.AutoScaling_MaxWorkerCount.Value;
            }
            if (requestCapacity_capacity_AutoScaling_autoScaling_MaxWorkerCount != null)
            {
                requestCapacity_capacity_AutoScaling.MaxWorkerCount = requestCapacity_capacity_AutoScaling_autoScaling_MaxWorkerCount.Value;
                requestCapacity_capacity_AutoScalingIsNull          = false;
            }
            System.Int32?requestCapacity_capacity_AutoScaling_autoScaling_McuCount = null;
            if (cmdletContext.AutoScaling_McuCount != null)
            {
                requestCapacity_capacity_AutoScaling_autoScaling_McuCount = cmdletContext.AutoScaling_McuCount.Value;
            }
            if (requestCapacity_capacity_AutoScaling_autoScaling_McuCount != null)
            {
                requestCapacity_capacity_AutoScaling.McuCount = requestCapacity_capacity_AutoScaling_autoScaling_McuCount.Value;
                requestCapacity_capacity_AutoScalingIsNull    = false;
            }
            System.Int32?requestCapacity_capacity_AutoScaling_autoScaling_MinWorkerCount = null;
            if (cmdletContext.AutoScaling_MinWorkerCount != null)
            {
                requestCapacity_capacity_AutoScaling_autoScaling_MinWorkerCount = cmdletContext.AutoScaling_MinWorkerCount.Value;
            }
            if (requestCapacity_capacity_AutoScaling_autoScaling_MinWorkerCount != null)
            {
                requestCapacity_capacity_AutoScaling.MinWorkerCount = requestCapacity_capacity_AutoScaling_autoScaling_MinWorkerCount.Value;
                requestCapacity_capacity_AutoScalingIsNull          = false;
            }
            Amazon.KafkaConnect.Model.ScaleInPolicyUpdate requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy = null;

            // populate ScaleInPolicy
            var requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicyIsNull = true;

            requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy = new Amazon.KafkaConnect.Model.ScaleInPolicyUpdate();
            System.Int32?requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy_scaleInPolicy_CpuUtilizationPercentage = null;
            if (cmdletContext.ScaleInPolicy_CpuUtilizationPercentage != null)
            {
                requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy_scaleInPolicy_CpuUtilizationPercentage = cmdletContext.ScaleInPolicy_CpuUtilizationPercentage.Value;
            }
            if (requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy_scaleInPolicy_CpuUtilizationPercentage != null)
            {
                requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy.CpuUtilizationPercentage = requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy_scaleInPolicy_CpuUtilizationPercentage.Value;
                requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicyIsNull = false;
            }
            // determine if requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy should be set to null
            if (requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicyIsNull)
            {
                requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy = null;
            }
            if (requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy != null)
            {
                requestCapacity_capacity_AutoScaling.ScaleInPolicy = requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleInPolicy;
                requestCapacity_capacity_AutoScalingIsNull         = false;
            }
            Amazon.KafkaConnect.Model.ScaleOutPolicyUpdate requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy = null;

            // populate ScaleOutPolicy
            var requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicyIsNull = true;

            requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy = new Amazon.KafkaConnect.Model.ScaleOutPolicyUpdate();
            System.Int32?requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy_scaleOutPolicy_CpuUtilizationPercentage = null;
            if (cmdletContext.ScaleOutPolicy_CpuUtilizationPercentage != null)
            {
                requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy_scaleOutPolicy_CpuUtilizationPercentage = cmdletContext.ScaleOutPolicy_CpuUtilizationPercentage.Value;
            }
            if (requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy_scaleOutPolicy_CpuUtilizationPercentage != null)
            {
                requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy.CpuUtilizationPercentage = requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy_scaleOutPolicy_CpuUtilizationPercentage.Value;
                requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicyIsNull = false;
            }
            // determine if requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy should be set to null
            if (requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicyIsNull)
            {
                requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy = null;
            }
            if (requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy != null)
            {
                requestCapacity_capacity_AutoScaling.ScaleOutPolicy = requestCapacity_capacity_AutoScaling_capacity_AutoScaling_ScaleOutPolicy;
                requestCapacity_capacity_AutoScalingIsNull          = false;
            }
            // determine if requestCapacity_capacity_AutoScaling should be set to null
            if (requestCapacity_capacity_AutoScalingIsNull)
            {
                requestCapacity_capacity_AutoScaling = null;
            }
            if (requestCapacity_capacity_AutoScaling != null)
            {
                request.Capacity.AutoScaling = requestCapacity_capacity_AutoScaling;
                requestCapacityIsNull        = false;
            }
            // determine if request.Capacity should be set to null
            if (requestCapacityIsNull)
            {
                request.Capacity = null;
            }
            if (cmdletContext.ConnectorArn != null)
            {
                request.ConnectorArn = cmdletContext.ConnectorArn;
            }
            if (cmdletContext.CurrentVersion != null)
            {
                request.CurrentVersion = cmdletContext.CurrentVersion;
            }

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