private Amazon.SageMaker.Model.CreateInferenceRecommendationsJobResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateInferenceRecommendationsJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateInferenceRecommendationsJob"); try { #if DESKTOP return(client.CreateInferenceRecommendationsJob(request)); #elif CORECLR return(client.CreateInferenceRecommendationsJobAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.SageMaker.Model.CreateInferenceRecommendationsJobRequest(); // populate InputConfig var requestInputConfigIsNull = true; request.InputConfig = new Amazon.SageMaker.Model.RecommendationJobInputConfig(); List <Amazon.SageMaker.Model.EndpointInputConfiguration> requestInputConfig_inputConfig_EndpointConfiguration = null; if (cmdletContext.InputConfig_EndpointConfiguration != null) { requestInputConfig_inputConfig_EndpointConfiguration = cmdletContext.InputConfig_EndpointConfiguration; } if (requestInputConfig_inputConfig_EndpointConfiguration != null) { request.InputConfig.EndpointConfigurations = requestInputConfig_inputConfig_EndpointConfiguration; requestInputConfigIsNull = false; } System.Int32?requestInputConfig_inputConfig_JobDurationInSecond = null; if (cmdletContext.InputConfig_JobDurationInSecond != null) { requestInputConfig_inputConfig_JobDurationInSecond = cmdletContext.InputConfig_JobDurationInSecond.Value; } if (requestInputConfig_inputConfig_JobDurationInSecond != null) { request.InputConfig.JobDurationInSeconds = requestInputConfig_inputConfig_JobDurationInSecond.Value; requestInputConfigIsNull = false; } System.String requestInputConfig_inputConfig_ModelPackageVersionArn = null; if (cmdletContext.InputConfig_ModelPackageVersionArn != null) { requestInputConfig_inputConfig_ModelPackageVersionArn = cmdletContext.InputConfig_ModelPackageVersionArn; } if (requestInputConfig_inputConfig_ModelPackageVersionArn != null) { request.InputConfig.ModelPackageVersionArn = requestInputConfig_inputConfig_ModelPackageVersionArn; requestInputConfigIsNull = false; } Amazon.SageMaker.Model.RecommendationJobResourceLimit requestInputConfig_inputConfig_ResourceLimit = null; // populate ResourceLimit var requestInputConfig_inputConfig_ResourceLimitIsNull = true; requestInputConfig_inputConfig_ResourceLimit = new Amazon.SageMaker.Model.RecommendationJobResourceLimit(); System.Int32?requestInputConfig_inputConfig_ResourceLimit_resourceLimit_MaxNumberOfTest = null; if (cmdletContext.ResourceLimit_MaxNumberOfTest != null) { requestInputConfig_inputConfig_ResourceLimit_resourceLimit_MaxNumberOfTest = cmdletContext.ResourceLimit_MaxNumberOfTest.Value; } if (requestInputConfig_inputConfig_ResourceLimit_resourceLimit_MaxNumberOfTest != null) { requestInputConfig_inputConfig_ResourceLimit.MaxNumberOfTests = requestInputConfig_inputConfig_ResourceLimit_resourceLimit_MaxNumberOfTest.Value; requestInputConfig_inputConfig_ResourceLimitIsNull = false; } System.Int32?requestInputConfig_inputConfig_ResourceLimit_resourceLimit_MaxParallelOfTest = null; if (cmdletContext.ResourceLimit_MaxParallelOfTest != null) { requestInputConfig_inputConfig_ResourceLimit_resourceLimit_MaxParallelOfTest = cmdletContext.ResourceLimit_MaxParallelOfTest.Value; } if (requestInputConfig_inputConfig_ResourceLimit_resourceLimit_MaxParallelOfTest != null) { requestInputConfig_inputConfig_ResourceLimit.MaxParallelOfTests = requestInputConfig_inputConfig_ResourceLimit_resourceLimit_MaxParallelOfTest.Value; requestInputConfig_inputConfig_ResourceLimitIsNull = false; } // determine if requestInputConfig_inputConfig_ResourceLimit should be set to null if (requestInputConfig_inputConfig_ResourceLimitIsNull) { requestInputConfig_inputConfig_ResourceLimit = null; } if (requestInputConfig_inputConfig_ResourceLimit != null) { request.InputConfig.ResourceLimit = requestInputConfig_inputConfig_ResourceLimit; requestInputConfigIsNull = false; } Amazon.SageMaker.Model.TrafficPattern requestInputConfig_inputConfig_TrafficPattern = null; // populate TrafficPattern var requestInputConfig_inputConfig_TrafficPatternIsNull = true; requestInputConfig_inputConfig_TrafficPattern = new Amazon.SageMaker.Model.TrafficPattern(); List <Amazon.SageMaker.Model.Phase> requestInputConfig_inputConfig_TrafficPattern_trafficPattern_Phase = null; if (cmdletContext.TrafficPattern_Phase != null) { requestInputConfig_inputConfig_TrafficPattern_trafficPattern_Phase = cmdletContext.TrafficPattern_Phase; } if (requestInputConfig_inputConfig_TrafficPattern_trafficPattern_Phase != null) { requestInputConfig_inputConfig_TrafficPattern.Phases = requestInputConfig_inputConfig_TrafficPattern_trafficPattern_Phase; requestInputConfig_inputConfig_TrafficPatternIsNull = false; } Amazon.SageMaker.TrafficType requestInputConfig_inputConfig_TrafficPattern_trafficPattern_TrafficType = null; if (cmdletContext.TrafficPattern_TrafficType != null) { requestInputConfig_inputConfig_TrafficPattern_trafficPattern_TrafficType = cmdletContext.TrafficPattern_TrafficType; } if (requestInputConfig_inputConfig_TrafficPattern_trafficPattern_TrafficType != null) { requestInputConfig_inputConfig_TrafficPattern.TrafficType = requestInputConfig_inputConfig_TrafficPattern_trafficPattern_TrafficType; requestInputConfig_inputConfig_TrafficPatternIsNull = false; } // determine if requestInputConfig_inputConfig_TrafficPattern should be set to null if (requestInputConfig_inputConfig_TrafficPatternIsNull) { requestInputConfig_inputConfig_TrafficPattern = null; } if (requestInputConfig_inputConfig_TrafficPattern != null) { request.InputConfig.TrafficPattern = requestInputConfig_inputConfig_TrafficPattern; requestInputConfigIsNull = false; } // determine if request.InputConfig should be set to null if (requestInputConfigIsNull) { request.InputConfig = null; } if (cmdletContext.JobDescription != null) { request.JobDescription = cmdletContext.JobDescription; } if (cmdletContext.JobName != null) { request.JobName = cmdletContext.JobName; } if (cmdletContext.JobType != null) { request.JobType = cmdletContext.JobType; } if (cmdletContext.RoleArn != null) { request.RoleArn = cmdletContext.RoleArn; } // populate StoppingConditions var requestStoppingConditionsIsNull = true; request.StoppingConditions = new Amazon.SageMaker.Model.RecommendationJobStoppingConditions(); System.Int32?requestStoppingConditions_stoppingConditions_MaxInvocation = null; if (cmdletContext.StoppingConditions_MaxInvocation != null) { requestStoppingConditions_stoppingConditions_MaxInvocation = cmdletContext.StoppingConditions_MaxInvocation.Value; } if (requestStoppingConditions_stoppingConditions_MaxInvocation != null) { request.StoppingConditions.MaxInvocations = requestStoppingConditions_stoppingConditions_MaxInvocation.Value; requestStoppingConditionsIsNull = false; } List <Amazon.SageMaker.Model.ModelLatencyThreshold> requestStoppingConditions_stoppingConditions_ModelLatencyThreshold = null; if (cmdletContext.StoppingConditions_ModelLatencyThreshold != null) { requestStoppingConditions_stoppingConditions_ModelLatencyThreshold = cmdletContext.StoppingConditions_ModelLatencyThreshold; } if (requestStoppingConditions_stoppingConditions_ModelLatencyThreshold != null) { request.StoppingConditions.ModelLatencyThresholds = requestStoppingConditions_stoppingConditions_ModelLatencyThreshold; requestStoppingConditionsIsNull = false; } // determine if request.StoppingConditions should be set to null if (requestStoppingConditionsIsNull) { request.StoppingConditions = null; } 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); }