public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; var useParameterSelect = this.Select.StartsWith("^"); // create request and set iteration invariants var request = new Amazon.Glue.Model.ListMLTransformsRequest(); // populate Filter var requestFilterIsNull = true; request.Filter = new Amazon.Glue.Model.TransformFilterCriteria(); System.DateTime?requestFilter_filter_CreatedAfter = null; if (cmdletContext.Filter_CreatedAfter != null) { requestFilter_filter_CreatedAfter = cmdletContext.Filter_CreatedAfter.Value; } if (requestFilter_filter_CreatedAfter != null) { request.Filter.CreatedAfter = requestFilter_filter_CreatedAfter.Value; requestFilterIsNull = false; } System.DateTime?requestFilter_filter_CreatedBefore = null; if (cmdletContext.Filter_CreatedBefore != null) { requestFilter_filter_CreatedBefore = cmdletContext.Filter_CreatedBefore.Value; } if (requestFilter_filter_CreatedBefore != null) { request.Filter.CreatedBefore = requestFilter_filter_CreatedBefore.Value; requestFilterIsNull = false; } System.String requestFilter_filter_GlueVersion = null; if (cmdletContext.Filter_GlueVersion != null) { requestFilter_filter_GlueVersion = cmdletContext.Filter_GlueVersion; } if (requestFilter_filter_GlueVersion != null) { request.Filter.GlueVersion = requestFilter_filter_GlueVersion; requestFilterIsNull = false; } System.DateTime?requestFilter_filter_LastModifiedAfter = null; if (cmdletContext.Filter_LastModifiedAfter != null) { requestFilter_filter_LastModifiedAfter = cmdletContext.Filter_LastModifiedAfter.Value; } if (requestFilter_filter_LastModifiedAfter != null) { request.Filter.LastModifiedAfter = requestFilter_filter_LastModifiedAfter.Value; requestFilterIsNull = false; } System.DateTime?requestFilter_filter_LastModifiedBefore = null; if (cmdletContext.Filter_LastModifiedBefore != null) { requestFilter_filter_LastModifiedBefore = cmdletContext.Filter_LastModifiedBefore.Value; } if (requestFilter_filter_LastModifiedBefore != null) { request.Filter.LastModifiedBefore = requestFilter_filter_LastModifiedBefore.Value; requestFilterIsNull = false; } System.String requestFilter_filter_Name = null; if (cmdletContext.Filter_Name != null) { requestFilter_filter_Name = cmdletContext.Filter_Name; } if (requestFilter_filter_Name != null) { request.Filter.Name = requestFilter_filter_Name; requestFilterIsNull = false; } List <Amazon.Glue.Model.SchemaColumn> requestFilter_filter_Schema = null; if (cmdletContext.Filter_Schema != null) { requestFilter_filter_Schema = cmdletContext.Filter_Schema; } if (requestFilter_filter_Schema != null) { request.Filter.Schema = requestFilter_filter_Schema; requestFilterIsNull = false; } Amazon.Glue.TransformStatusType requestFilter_filter_Status = null; if (cmdletContext.Filter_Status != null) { requestFilter_filter_Status = cmdletContext.Filter_Status; } if (requestFilter_filter_Status != null) { request.Filter.Status = requestFilter_filter_Status; requestFilterIsNull = false; } Amazon.Glue.TransformType requestFilter_filter_TransformType = null; if (cmdletContext.Filter_TransformType != null) { requestFilter_filter_TransformType = cmdletContext.Filter_TransformType; } if (requestFilter_filter_TransformType != null) { request.Filter.TransformType = requestFilter_filter_TransformType; requestFilterIsNull = false; } // determine if request.Filter should be set to null if (requestFilterIsNull) { request.Filter = null; } if (cmdletContext.MaxResult != null) { request.MaxResults = cmdletContext.MaxResult.Value; } // populate Sort var requestSortIsNull = true; request.Sort = new Amazon.Glue.Model.TransformSortCriteria(); Amazon.Glue.TransformSortColumnType requestSort_sort_Column = null; if (cmdletContext.Sort_Column != null) { requestSort_sort_Column = cmdletContext.Sort_Column; } if (requestSort_sort_Column != null) { request.Sort.Column = requestSort_sort_Column; requestSortIsNull = false; } Amazon.Glue.SortDirectionType requestSort_sort_SortDirection = null; if (cmdletContext.Sort_SortDirection != null) { requestSort_sort_SortDirection = cmdletContext.Sort_SortDirection; } if (requestSort_sort_SortDirection != null) { request.Sort.SortDirection = requestSort_sort_SortDirection; requestSortIsNull = false; } // determine if request.Sort should be set to null if (requestSortIsNull) { request.Sort = null; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } // 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); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; var useParameterSelect = this.Select.StartsWith("^"); // create request and set iteration invariants var request = new Amazon.Glue.Model.GetMLTransformsRequest(); // populate Filter var requestFilterIsNull = true; request.Filter = new Amazon.Glue.Model.TransformFilterCriteria(); System.DateTime?requestFilter_filter_CreatedAfter = null; if (cmdletContext.Filter_CreatedAfter != null) { requestFilter_filter_CreatedAfter = cmdletContext.Filter_CreatedAfter.Value; } if (requestFilter_filter_CreatedAfter != null) { request.Filter.CreatedAfter = requestFilter_filter_CreatedAfter.Value; requestFilterIsNull = false; } System.DateTime?requestFilter_filter_CreatedBefore = null; if (cmdletContext.Filter_CreatedBefore != null) { requestFilter_filter_CreatedBefore = cmdletContext.Filter_CreatedBefore.Value; } if (requestFilter_filter_CreatedBefore != null) { request.Filter.CreatedBefore = requestFilter_filter_CreatedBefore.Value; requestFilterIsNull = false; } System.String requestFilter_filter_GlueVersion = null; if (cmdletContext.Filter_GlueVersion != null) { requestFilter_filter_GlueVersion = cmdletContext.Filter_GlueVersion; } if (requestFilter_filter_GlueVersion != null) { request.Filter.GlueVersion = requestFilter_filter_GlueVersion; requestFilterIsNull = false; } System.DateTime?requestFilter_filter_LastModifiedAfter = null; if (cmdletContext.Filter_LastModifiedAfter != null) { requestFilter_filter_LastModifiedAfter = cmdletContext.Filter_LastModifiedAfter.Value; } if (requestFilter_filter_LastModifiedAfter != null) { request.Filter.LastModifiedAfter = requestFilter_filter_LastModifiedAfter.Value; requestFilterIsNull = false; } System.DateTime?requestFilter_filter_LastModifiedBefore = null; if (cmdletContext.Filter_LastModifiedBefore != null) { requestFilter_filter_LastModifiedBefore = cmdletContext.Filter_LastModifiedBefore.Value; } if (requestFilter_filter_LastModifiedBefore != null) { request.Filter.LastModifiedBefore = requestFilter_filter_LastModifiedBefore.Value; requestFilterIsNull = false; } System.String requestFilter_filter_Name = null; if (cmdletContext.Filter_Name != null) { requestFilter_filter_Name = cmdletContext.Filter_Name; } if (requestFilter_filter_Name != null) { request.Filter.Name = requestFilter_filter_Name; requestFilterIsNull = false; } List <Amazon.Glue.Model.SchemaColumn> requestFilter_filter_Schema = null; if (cmdletContext.Filter_Schema != null) { requestFilter_filter_Schema = cmdletContext.Filter_Schema; } if (requestFilter_filter_Schema != null) { request.Filter.Schema = requestFilter_filter_Schema; requestFilterIsNull = false; } Amazon.Glue.TransformStatusType requestFilter_filter_Status = null; if (cmdletContext.Filter_Status != null) { requestFilter_filter_Status = cmdletContext.Filter_Status; } if (requestFilter_filter_Status != null) { request.Filter.Status = requestFilter_filter_Status; requestFilterIsNull = false; } Amazon.Glue.TransformType requestFilter_filter_TransformType = null; if (cmdletContext.Filter_TransformType != null) { requestFilter_filter_TransformType = cmdletContext.Filter_TransformType; } if (requestFilter_filter_TransformType != null) { request.Filter.TransformType = requestFilter_filter_TransformType; requestFilterIsNull = false; } // determine if request.Filter should be set to null if (requestFilterIsNull) { request.Filter = null; } // populate Sort var requestSortIsNull = true; request.Sort = new Amazon.Glue.Model.TransformSortCriteria(); Amazon.Glue.TransformSortColumnType requestSort_sort_Column = null; if (cmdletContext.Sort_Column != null) { requestSort_sort_Column = cmdletContext.Sort_Column; } if (requestSort_sort_Column != null) { request.Sort.Column = requestSort_sort_Column; requestSortIsNull = false; } Amazon.Glue.SortDirectionType requestSort_sort_SortDirection = null; if (cmdletContext.Sort_SortDirection != null) { requestSort_sort_SortDirection = cmdletContext.Sort_SortDirection; } if (requestSort_sort_SortDirection != null) { request.Sort.SortDirection = requestSort_sort_SortDirection; requestSortIsNull = false; } // determine if request.Sort should be set to null if (requestSortIsNull) { request.Sort = null; } // Initialize loop variants and commence piping System.String _nextToken = null; int? _emitLimit = null; int _retrievedSoFar = 0; if (AutoIterationHelpers.HasValue(cmdletContext.NextToken)) { _nextToken = cmdletContext.NextToken; } if (cmdletContext.MaxResult.HasValue) { // The service has a maximum page size of 1000. If the user has // asked for more items than page max, and there is no page size // configured, we rely on the service ignoring the set maximum // and giving us 1000 items back. If a page size is set, that will // be used to configure the pagination. // We'll make further calls to satisfy the user's request. _emitLimit = cmdletContext.MaxResult; } var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.NextToken = _nextToken; if (_emitLimit.HasValue) { int correctPageSize = Math.Min(1000, _emitLimit.Value); request.MaxResults = AutoIterationHelpers.ConvertEmitLimitToInt32(correctPageSize); } 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 }; int _receivedThisCall = response.Transforms.Count; _nextToken = response.NextToken; _retrievedSoFar += _receivedThisCall; if (_emitLimit.HasValue) { _emitLimit -= _receivedThisCall; } } catch (Exception e) { if (_retrievedSoFar == 0 || !_emitLimit.HasValue) { output = new CmdletOutput { ErrorResponse = e }; } else { break; } } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken) && (!_emitLimit.HasValue || _emitLimit.Value >= 1)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }