private Amazon.CloudWatchEvidently.Model.UpdateExperimentResponse CallAWSServiceOperation(IAmazonCloudWatchEvidently client, Amazon.CloudWatchEvidently.Model.UpdateExperimentRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudWatch Evidently", "UpdateExperiment"); try { #if DESKTOP return(client.UpdateExperiment(request)); #elif CORECLR return(client.UpdateExperimentAsync(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.CloudWatchEvidently.Model.UpdateExperimentRequest(); if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Experiment != null) { request.Experiment = cmdletContext.Experiment; } if (cmdletContext.MetricGoal != null) { request.MetricGoals = cmdletContext.MetricGoal; } // populate OnlineAbConfig var requestOnlineAbConfigIsNull = true; request.OnlineAbConfig = new Amazon.CloudWatchEvidently.Model.OnlineAbConfig(); System.String requestOnlineAbConfig_onlineAbConfig_ControlTreatmentName = null; if (cmdletContext.OnlineAbConfig_ControlTreatmentName != null) { requestOnlineAbConfig_onlineAbConfig_ControlTreatmentName = cmdletContext.OnlineAbConfig_ControlTreatmentName; } if (requestOnlineAbConfig_onlineAbConfig_ControlTreatmentName != null) { request.OnlineAbConfig.ControlTreatmentName = requestOnlineAbConfig_onlineAbConfig_ControlTreatmentName; requestOnlineAbConfigIsNull = false; } Dictionary <System.String, System.Int64> requestOnlineAbConfig_onlineAbConfig_TreatmentWeight = null; if (cmdletContext.OnlineAbConfig_TreatmentWeight != null) { requestOnlineAbConfig_onlineAbConfig_TreatmentWeight = cmdletContext.OnlineAbConfig_TreatmentWeight; } if (requestOnlineAbConfig_onlineAbConfig_TreatmentWeight != null) { request.OnlineAbConfig.TreatmentWeights = requestOnlineAbConfig_onlineAbConfig_TreatmentWeight; requestOnlineAbConfigIsNull = false; } // determine if request.OnlineAbConfig should be set to null if (requestOnlineAbConfigIsNull) { request.OnlineAbConfig = null; } if (cmdletContext.Project != null) { request.Project = cmdletContext.Project; } if (cmdletContext.RandomizationSalt != null) { request.RandomizationSalt = cmdletContext.RandomizationSalt; } if (cmdletContext.SamplingRate != null) { request.SamplingRate = cmdletContext.SamplingRate.Value; } if (cmdletContext.Treatment != null) { request.Treatments = cmdletContext.Treatment; } 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); }