private Amazon.Personalize.Model.CreateSolutionResponse CallAWSServiceOperation(IAmazonPersonalize client, Amazon.Personalize.Model.CreateSolutionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Personalize", "CreateSolution"); try { #if DESKTOP return(client.CreateSolution(request)); #elif CORECLR return(client.CreateSolutionAsync(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.Personalize.Model.CreateSolutionRequest(); if (cmdletContext.DatasetGroupArn != null) { request.DatasetGroupArn = cmdletContext.DatasetGroupArn; } if (cmdletContext.EventType != null) { request.EventType = cmdletContext.EventType; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.PerformAutoML != null) { request.PerformAutoML = cmdletContext.PerformAutoML.Value; } if (cmdletContext.PerformHPO != null) { request.PerformHPO = cmdletContext.PerformHPO.Value; } if (cmdletContext.RecipeArn != null) { request.RecipeArn = cmdletContext.RecipeArn; } // populate SolutionConfig var requestSolutionConfigIsNull = true; request.SolutionConfig = new Amazon.Personalize.Model.SolutionConfig(); Dictionary <System.String, System.String> requestSolutionConfig_solutionConfig_AlgorithmHyperParameter = null; if (cmdletContext.SolutionConfig_AlgorithmHyperParameter != null) { requestSolutionConfig_solutionConfig_AlgorithmHyperParameter = cmdletContext.SolutionConfig_AlgorithmHyperParameter; } if (requestSolutionConfig_solutionConfig_AlgorithmHyperParameter != null) { request.SolutionConfig.AlgorithmHyperParameters = requestSolutionConfig_solutionConfig_AlgorithmHyperParameter; requestSolutionConfigIsNull = false; } System.String requestSolutionConfig_solutionConfig_EventValueThreshold = null; if (cmdletContext.SolutionConfig_EventValueThreshold != null) { requestSolutionConfig_solutionConfig_EventValueThreshold = cmdletContext.SolutionConfig_EventValueThreshold; } if (requestSolutionConfig_solutionConfig_EventValueThreshold != null) { request.SolutionConfig.EventValueThreshold = requestSolutionConfig_solutionConfig_EventValueThreshold; requestSolutionConfigIsNull = false; } Dictionary <System.String, System.String> requestSolutionConfig_solutionConfig_FeatureTransformationParameter = null; if (cmdletContext.SolutionConfig_FeatureTransformationParameter != null) { requestSolutionConfig_solutionConfig_FeatureTransformationParameter = cmdletContext.SolutionConfig_FeatureTransformationParameter; } if (requestSolutionConfig_solutionConfig_FeatureTransformationParameter != null) { request.SolutionConfig.FeatureTransformationParameters = requestSolutionConfig_solutionConfig_FeatureTransformationParameter; requestSolutionConfigIsNull = false; } Amazon.Personalize.Model.AutoMLConfig requestSolutionConfig_solutionConfig_AutoMLConfig = null; // populate AutoMLConfig var requestSolutionConfig_solutionConfig_AutoMLConfigIsNull = true; requestSolutionConfig_solutionConfig_AutoMLConfig = new Amazon.Personalize.Model.AutoMLConfig(); System.String requestSolutionConfig_solutionConfig_AutoMLConfig_autoMLConfig_MetricName = null; if (cmdletContext.AutoMLConfig_MetricName != null) { requestSolutionConfig_solutionConfig_AutoMLConfig_autoMLConfig_MetricName = cmdletContext.AutoMLConfig_MetricName; } if (requestSolutionConfig_solutionConfig_AutoMLConfig_autoMLConfig_MetricName != null) { requestSolutionConfig_solutionConfig_AutoMLConfig.MetricName = requestSolutionConfig_solutionConfig_AutoMLConfig_autoMLConfig_MetricName; requestSolutionConfig_solutionConfig_AutoMLConfigIsNull = false; } List <System.String> requestSolutionConfig_solutionConfig_AutoMLConfig_autoMLConfig_RecipeList = null; if (cmdletContext.AutoMLConfig_RecipeList != null) { requestSolutionConfig_solutionConfig_AutoMLConfig_autoMLConfig_RecipeList = cmdletContext.AutoMLConfig_RecipeList; } if (requestSolutionConfig_solutionConfig_AutoMLConfig_autoMLConfig_RecipeList != null) { requestSolutionConfig_solutionConfig_AutoMLConfig.RecipeList = requestSolutionConfig_solutionConfig_AutoMLConfig_autoMLConfig_RecipeList; requestSolutionConfig_solutionConfig_AutoMLConfigIsNull = false; } // determine if requestSolutionConfig_solutionConfig_AutoMLConfig should be set to null if (requestSolutionConfig_solutionConfig_AutoMLConfigIsNull) { requestSolutionConfig_solutionConfig_AutoMLConfig = null; } if (requestSolutionConfig_solutionConfig_AutoMLConfig != null) { request.SolutionConfig.AutoMLConfig = requestSolutionConfig_solutionConfig_AutoMLConfig; requestSolutionConfigIsNull = false; } Amazon.Personalize.Model.HPOConfig requestSolutionConfig_solutionConfig_HpoConfig = null; // populate HpoConfig var requestSolutionConfig_solutionConfig_HpoConfigIsNull = true; requestSolutionConfig_solutionConfig_HpoConfig = new Amazon.Personalize.Model.HPOConfig(); Amazon.Personalize.Model.HPOResourceConfig requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig = null; // populate HpoResourceConfig var requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfigIsNull = true; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig = new Amazon.Personalize.Model.HPOResourceConfig(); System.String requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig_hpoResourceConfig_MaxNumberOfTrainingJob = null; if (cmdletContext.HpoResourceConfig_MaxNumberOfTrainingJob != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig_hpoResourceConfig_MaxNumberOfTrainingJob = cmdletContext.HpoResourceConfig_MaxNumberOfTrainingJob; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig_hpoResourceConfig_MaxNumberOfTrainingJob != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig.MaxNumberOfTrainingJobs = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig_hpoResourceConfig_MaxNumberOfTrainingJob; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfigIsNull = false; } System.String requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig_hpoResourceConfig_MaxParallelTrainingJob = null; if (cmdletContext.HpoResourceConfig_MaxParallelTrainingJob != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig_hpoResourceConfig_MaxParallelTrainingJob = cmdletContext.HpoResourceConfig_MaxParallelTrainingJob; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig_hpoResourceConfig_MaxParallelTrainingJob != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig.MaxParallelTrainingJobs = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig_hpoResourceConfig_MaxParallelTrainingJob; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfigIsNull = false; } // determine if requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig should be set to null if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfigIsNull) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig = null; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig != null) { requestSolutionConfig_solutionConfig_HpoConfig.HpoResourceConfig = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoResourceConfig; requestSolutionConfig_solutionConfig_HpoConfigIsNull = false; } Amazon.Personalize.Model.HyperParameterRanges requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges = null; // populate AlgorithmHyperParameterRanges var requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRangesIsNull = true; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges = new Amazon.Personalize.Model.HyperParameterRanges(); List <Amazon.Personalize.Model.CategoricalHyperParameterRange> requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_CategoricalHyperParameterRange = null; if (cmdletContext.AlgorithmHyperParameterRanges_CategoricalHyperParameterRange != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_CategoricalHyperParameterRange = cmdletContext.AlgorithmHyperParameterRanges_CategoricalHyperParameterRange; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_CategoricalHyperParameterRange != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges.CategoricalHyperParameterRanges = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_CategoricalHyperParameterRange; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRangesIsNull = false; } List <Amazon.Personalize.Model.ContinuousHyperParameterRange> requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_ContinuousHyperParameterRange = null; if (cmdletContext.AlgorithmHyperParameterRanges_ContinuousHyperParameterRange != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_ContinuousHyperParameterRange = cmdletContext.AlgorithmHyperParameterRanges_ContinuousHyperParameterRange; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_ContinuousHyperParameterRange != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges.ContinuousHyperParameterRanges = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_ContinuousHyperParameterRange; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRangesIsNull = false; } List <Amazon.Personalize.Model.IntegerHyperParameterRange> requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_IntegerHyperParameterRange = null; if (cmdletContext.AlgorithmHyperParameterRanges_IntegerHyperParameterRange != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_IntegerHyperParameterRange = cmdletContext.AlgorithmHyperParameterRanges_IntegerHyperParameterRange; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_IntegerHyperParameterRange != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges.IntegerHyperParameterRanges = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges_algorithmHyperParameterRanges_IntegerHyperParameterRange; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRangesIsNull = false; } // determine if requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges should be set to null if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRangesIsNull) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges = null; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges != null) { requestSolutionConfig_solutionConfig_HpoConfig.AlgorithmHyperParameterRanges = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_AlgorithmHyperParameterRanges; requestSolutionConfig_solutionConfig_HpoConfigIsNull = false; } Amazon.Personalize.Model.HPOObjective requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective = null; // populate HpoObjective var requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjectiveIsNull = true; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective = new Amazon.Personalize.Model.HPOObjective(); System.String requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_MetricName = null; if (cmdletContext.HpoObjective_MetricName != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_MetricName = cmdletContext.HpoObjective_MetricName; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_MetricName != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective.MetricName = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_MetricName; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjectiveIsNull = false; } System.String requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_MetricRegex = null; if (cmdletContext.HpoObjective_MetricRegex != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_MetricRegex = cmdletContext.HpoObjective_MetricRegex; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_MetricRegex != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective.MetricRegex = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_MetricRegex; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjectiveIsNull = false; } System.String requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_Type = null; if (cmdletContext.HpoObjective_Type != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_Type = cmdletContext.HpoObjective_Type; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_Type != null) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective.Type = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective_hpoObjective_Type; requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjectiveIsNull = false; } // determine if requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective should be set to null if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjectiveIsNull) { requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective = null; } if (requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective != null) { requestSolutionConfig_solutionConfig_HpoConfig.HpoObjective = requestSolutionConfig_solutionConfig_HpoConfig_solutionConfig_HpoConfig_HpoObjective; requestSolutionConfig_solutionConfig_HpoConfigIsNull = false; } // determine if requestSolutionConfig_solutionConfig_HpoConfig should be set to null if (requestSolutionConfig_solutionConfig_HpoConfigIsNull) { requestSolutionConfig_solutionConfig_HpoConfig = null; } if (requestSolutionConfig_solutionConfig_HpoConfig != null) { request.SolutionConfig.HpoConfig = requestSolutionConfig_solutionConfig_HpoConfig; requestSolutionConfigIsNull = false; } // determine if request.SolutionConfig should be set to null if (requestSolutionConfigIsNull) { request.SolutionConfig = 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); }