Esempio n. 1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SageMaker.Model.CreateEndpointConfigRequest();

            if (cmdletContext.EndpointConfigName != null)
            {
                request.EndpointConfigName = cmdletContext.EndpointConfigName;
            }
            if (cmdletContext.KmsKeyId != null)
            {
                request.KmsKeyId = cmdletContext.KmsKeyId;
            }
            if (cmdletContext.ProductionVariant != null)
            {
                request.ProductionVariants = cmdletContext.ProductionVariant;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }
Esempio n. 2
0
 private Amazon.SageMaker.Model.CreateEndpointConfigResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateEndpointConfigRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateEndpointConfig");
     try
     {
         #if DESKTOP
         return(client.CreateEndpointConfig(request));
         #elif CORECLR
         return(client.CreateEndpointConfigAsync(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;
     }
 }
Esempio n. 3
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SageMaker.Model.CreateEndpointConfigRequest();


            // populate AsyncInferenceConfig
            var requestAsyncInferenceConfigIsNull = true;

            request.AsyncInferenceConfig = new Amazon.SageMaker.Model.AsyncInferenceConfig();
            Amazon.SageMaker.Model.AsyncInferenceClientConfig requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig = null;

            // populate ClientConfig
            var requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfigIsNull = true;

            requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig = new Amazon.SageMaker.Model.AsyncInferenceClientConfig();
            System.Int32?requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig_clientConfig_MaxConcurrentInvocationsPerInstance = null;
            if (cmdletContext.ClientConfig_MaxConcurrentInvocationsPerInstance != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig_clientConfig_MaxConcurrentInvocationsPerInstance = cmdletContext.ClientConfig_MaxConcurrentInvocationsPerInstance.Value;
            }
            if (requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig_clientConfig_MaxConcurrentInvocationsPerInstance != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig.MaxConcurrentInvocationsPerInstance = requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig_clientConfig_MaxConcurrentInvocationsPerInstance.Value;
                requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfigIsNull = false;
            }
            // determine if requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig should be set to null
            if (requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfigIsNull)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig = null;
            }
            if (requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig != null)
            {
                request.AsyncInferenceConfig.ClientConfig = requestAsyncInferenceConfig_asyncInferenceConfig_ClientConfig;
                requestAsyncInferenceConfigIsNull         = false;
            }
            Amazon.SageMaker.Model.AsyncInferenceOutputConfig requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig = null;

            // populate OutputConfig
            var requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfigIsNull = true;

            requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig = new Amazon.SageMaker.Model.AsyncInferenceOutputConfig();
            System.String requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_outputConfig_KmsKeyId = null;
            if (cmdletContext.OutputConfig_KmsKeyId != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_outputConfig_KmsKeyId = cmdletContext.OutputConfig_KmsKeyId;
            }
            if (requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_outputConfig_KmsKeyId != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig.KmsKeyId = requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_outputConfig_KmsKeyId;
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfigIsNull    = false;
            }
            System.String requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_outputConfig_S3OutputPath = null;
            if (cmdletContext.OutputConfig_S3OutputPath != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_outputConfig_S3OutputPath = cmdletContext.OutputConfig_S3OutputPath;
            }
            if (requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_outputConfig_S3OutputPath != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig.S3OutputPath = requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_outputConfig_S3OutputPath;
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfigIsNull        = false;
            }
            Amazon.SageMaker.Model.AsyncInferenceNotificationConfig requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig = null;

            // populate NotificationConfig
            var requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfigIsNull = true;

            requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig = new Amazon.SageMaker.Model.AsyncInferenceNotificationConfig();
            System.String requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig_notificationConfig_ErrorTopic = null;
            if (cmdletContext.NotificationConfig_ErrorTopic != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig_notificationConfig_ErrorTopic = cmdletContext.NotificationConfig_ErrorTopic;
            }
            if (requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig_notificationConfig_ErrorTopic != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig.ErrorTopic = requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig_notificationConfig_ErrorTopic;
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfigIsNull      = false;
            }
            System.String requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig_notificationConfig_SuccessTopic = null;
            if (cmdletContext.NotificationConfig_SuccessTopic != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig_notificationConfig_SuccessTopic = cmdletContext.NotificationConfig_SuccessTopic;
            }
            if (requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig_notificationConfig_SuccessTopic != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig.SuccessTopic = requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig_notificationConfig_SuccessTopic;
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfigIsNull        = false;
            }
            // determine if requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig should be set to null
            if (requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfigIsNull)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig = null;
            }
            if (requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig != null)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig.NotificationConfig = requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig_asyncInferenceConfig_OutputConfig_NotificationConfig;
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfigIsNull = false;
            }
            // determine if requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig should be set to null
            if (requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfigIsNull)
            {
                requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig = null;
            }
            if (requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig != null)
            {
                request.AsyncInferenceConfig.OutputConfig = requestAsyncInferenceConfig_asyncInferenceConfig_OutputConfig;
                requestAsyncInferenceConfigIsNull         = false;
            }
            // determine if request.AsyncInferenceConfig should be set to null
            if (requestAsyncInferenceConfigIsNull)
            {
                request.AsyncInferenceConfig = null;
            }

            // populate DataCaptureConfig
            var requestDataCaptureConfigIsNull = true;

            request.DataCaptureConfig = new Amazon.SageMaker.Model.DataCaptureConfig();
            List <Amazon.SageMaker.Model.CaptureOption> requestDataCaptureConfig_dataCaptureConfig_CaptureOption = null;

            if (cmdletContext.DataCaptureConfig_CaptureOption != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_CaptureOption = cmdletContext.DataCaptureConfig_CaptureOption;
            }
            if (requestDataCaptureConfig_dataCaptureConfig_CaptureOption != null)
            {
                request.DataCaptureConfig.CaptureOptions = requestDataCaptureConfig_dataCaptureConfig_CaptureOption;
                requestDataCaptureConfigIsNull           = false;
            }
            System.String requestDataCaptureConfig_dataCaptureConfig_DestinationS3Uri = null;
            if (cmdletContext.DataCaptureConfig_DestinationS3Uri != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_DestinationS3Uri = cmdletContext.DataCaptureConfig_DestinationS3Uri;
            }
            if (requestDataCaptureConfig_dataCaptureConfig_DestinationS3Uri != null)
            {
                request.DataCaptureConfig.DestinationS3Uri = requestDataCaptureConfig_dataCaptureConfig_DestinationS3Uri;
                requestDataCaptureConfigIsNull             = false;
            }
            System.Boolean?requestDataCaptureConfig_dataCaptureConfig_EnableCapture = null;
            if (cmdletContext.DataCaptureConfig_EnableCapture != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_EnableCapture = cmdletContext.DataCaptureConfig_EnableCapture.Value;
            }
            if (requestDataCaptureConfig_dataCaptureConfig_EnableCapture != null)
            {
                request.DataCaptureConfig.EnableCapture = requestDataCaptureConfig_dataCaptureConfig_EnableCapture.Value;
                requestDataCaptureConfigIsNull          = false;
            }
            System.Int32?requestDataCaptureConfig_dataCaptureConfig_InitialSamplingPercentage = null;
            if (cmdletContext.DataCaptureConfig_InitialSamplingPercentage != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_InitialSamplingPercentage = cmdletContext.DataCaptureConfig_InitialSamplingPercentage.Value;
            }
            if (requestDataCaptureConfig_dataCaptureConfig_InitialSamplingPercentage != null)
            {
                request.DataCaptureConfig.InitialSamplingPercentage = requestDataCaptureConfig_dataCaptureConfig_InitialSamplingPercentage.Value;
                requestDataCaptureConfigIsNull = false;
            }
            System.String requestDataCaptureConfig_dataCaptureConfig_KmsKeyId = null;
            if (cmdletContext.DataCaptureConfig_KmsKeyId != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_KmsKeyId = cmdletContext.DataCaptureConfig_KmsKeyId;
            }
            if (requestDataCaptureConfig_dataCaptureConfig_KmsKeyId != null)
            {
                request.DataCaptureConfig.KmsKeyId = requestDataCaptureConfig_dataCaptureConfig_KmsKeyId;
                requestDataCaptureConfigIsNull     = false;
            }
            Amazon.SageMaker.Model.CaptureContentTypeHeader requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader = null;

            // populate CaptureContentTypeHeader
            var requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeaderIsNull = true;

            requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader = new Amazon.SageMaker.Model.CaptureContentTypeHeader();
            List <System.String> requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader_captureContentTypeHeader_CsvContentType = null;

            if (cmdletContext.CaptureContentTypeHeader_CsvContentType != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader_captureContentTypeHeader_CsvContentType = cmdletContext.CaptureContentTypeHeader_CsvContentType;
            }
            if (requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader_captureContentTypeHeader_CsvContentType != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader.CsvContentTypes = requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader_captureContentTypeHeader_CsvContentType;
                requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeaderIsNull           = false;
            }
            List <System.String> requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader_captureContentTypeHeader_JsonContentType = null;

            if (cmdletContext.CaptureContentTypeHeader_JsonContentType != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader_captureContentTypeHeader_JsonContentType = cmdletContext.CaptureContentTypeHeader_JsonContentType;
            }
            if (requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader_captureContentTypeHeader_JsonContentType != null)
            {
                requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader.JsonContentTypes = requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader_captureContentTypeHeader_JsonContentType;
                requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeaderIsNull            = false;
            }
            // determine if requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader should be set to null
            if (requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeaderIsNull)
            {
                requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader = null;
            }
            if (requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader != null)
            {
                request.DataCaptureConfig.CaptureContentTypeHeader = requestDataCaptureConfig_dataCaptureConfig_CaptureContentTypeHeader;
                requestDataCaptureConfigIsNull = false;
            }
            // determine if request.DataCaptureConfig should be set to null
            if (requestDataCaptureConfigIsNull)
            {
                request.DataCaptureConfig = null;
            }
            if (cmdletContext.EndpointConfigName != null)
            {
                request.EndpointConfigName = cmdletContext.EndpointConfigName;
            }
            if (cmdletContext.KmsKeyId != null)
            {
                request.KmsKeyId = cmdletContext.KmsKeyId;
            }
            if (cmdletContext.ProductionVariant != null)
            {
                request.ProductionVariants = cmdletContext.ProductionVariant;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

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