public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.XRay.Model.GetTraceSummariesRequest(); if (cmdletContext.EndTime != null) { request.EndTime = cmdletContext.EndTime.Value; } if (cmdletContext.FilterExpression != null) { request.FilterExpression = cmdletContext.FilterExpression; } if (cmdletContext.NextToken != null) { request.NextToken = cmdletContext.NextToken; } if (cmdletContext.Sampling != null) { request.Sampling = cmdletContext.Sampling.Value; } // populate SamplingStrategy var requestSamplingStrategyIsNull = true; request.SamplingStrategy = new Amazon.XRay.Model.SamplingStrategy(); Amazon.XRay.SamplingStrategyName requestSamplingStrategy_samplingStrategy_Name = null; if (cmdletContext.SamplingStrategy_Name != null) { requestSamplingStrategy_samplingStrategy_Name = cmdletContext.SamplingStrategy_Name; } if (requestSamplingStrategy_samplingStrategy_Name != null) { request.SamplingStrategy.Name = requestSamplingStrategy_samplingStrategy_Name; requestSamplingStrategyIsNull = false; } System.Double?requestSamplingStrategy_samplingStrategy_Value = null; if (cmdletContext.SamplingStrategy_Value != null) { requestSamplingStrategy_samplingStrategy_Value = cmdletContext.SamplingStrategy_Value.Value; } if (requestSamplingStrategy_samplingStrategy_Value != null) { request.SamplingStrategy.Value = requestSamplingStrategy_samplingStrategy_Value.Value; requestSamplingStrategyIsNull = false; } // determine if request.SamplingStrategy should be set to null if (requestSamplingStrategyIsNull) { request.SamplingStrategy = null; } if (cmdletContext.StartTime != null) { request.StartTime = cmdletContext.StartTime.Value; } if (cmdletContext.TimeRangeType != null) { request.TimeRangeType = cmdletContext.TimeRangeType; } 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); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent; #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute // create request and set iteration invariants var request = new Amazon.XRay.Model.GetTraceSummariesRequest(); if (cmdletContext.EndTime != null) { request.EndTime = cmdletContext.EndTime.Value; } if (cmdletContext.FilterExpression != null) { request.FilterExpression = cmdletContext.FilterExpression; } if (cmdletContext.Sampling != null) { request.Sampling = cmdletContext.Sampling.Value; } // populate SamplingStrategy var requestSamplingStrategyIsNull = true; request.SamplingStrategy = new Amazon.XRay.Model.SamplingStrategy(); Amazon.XRay.SamplingStrategyName requestSamplingStrategy_samplingStrategy_Name = null; if (cmdletContext.SamplingStrategy_Name != null) { requestSamplingStrategy_samplingStrategy_Name = cmdletContext.SamplingStrategy_Name; } if (requestSamplingStrategy_samplingStrategy_Name != null) { request.SamplingStrategy.Name = requestSamplingStrategy_samplingStrategy_Name; requestSamplingStrategyIsNull = false; } System.Double?requestSamplingStrategy_samplingStrategy_Value = null; if (cmdletContext.SamplingStrategy_Value != null) { requestSamplingStrategy_samplingStrategy_Value = cmdletContext.SamplingStrategy_Value.Value; } if (requestSamplingStrategy_samplingStrategy_Value != null) { request.SamplingStrategy.Value = requestSamplingStrategy_samplingStrategy_Value.Value; requestSamplingStrategyIsNull = false; } // determine if request.SamplingStrategy should be set to null if (requestSamplingStrategyIsNull) { request.SamplingStrategy = null; } if (cmdletContext.StartTime != null) { request.StartTime = cmdletContext.StartTime.Value; } if (cmdletContext.TimeRangeType != null) { request.TimeRangeType = cmdletContext.TimeRangeType; } // Initialize loop variant and commence piping var _nextToken = cmdletContext.NextToken; var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.NextToken = _nextToken; CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; _nextToken = response.NextToken; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }