Example #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.PI.Model.DescribeDimensionKeysRequest();

            if (cmdletContext.EndTime != null)
            {
                request.EndTime = cmdletContext.EndTime.Value;
            }
            if (cmdletContext.Filter != null)
            {
                request.Filter = cmdletContext.Filter;
            }

            // populate GroupBy
            var requestGroupByIsNull = true;

            request.GroupBy = new Amazon.PI.Model.DimensionGroup();
            List <System.String> requestGroupBy_groupBy_Dimension = null;

            if (cmdletContext.GroupBy_Dimension != null)
            {
                requestGroupBy_groupBy_Dimension = cmdletContext.GroupBy_Dimension;
            }
            if (requestGroupBy_groupBy_Dimension != null)
            {
                request.GroupBy.Dimensions = requestGroupBy_groupBy_Dimension;
                requestGroupByIsNull       = false;
            }
            System.String requestGroupBy_groupBy_Group = null;
            if (cmdletContext.GroupBy_Group != null)
            {
                requestGroupBy_groupBy_Group = cmdletContext.GroupBy_Group;
            }
            if (requestGroupBy_groupBy_Group != null)
            {
                request.GroupBy.Group = requestGroupBy_groupBy_Group;
                requestGroupByIsNull  = false;
            }
            System.Int32?requestGroupBy_groupBy_Limit = null;
            if (cmdletContext.GroupBy_Limit != null)
            {
                requestGroupBy_groupBy_Limit = cmdletContext.GroupBy_Limit.Value;
            }
            if (requestGroupBy_groupBy_Limit != null)
            {
                request.GroupBy.Limit = requestGroupBy_groupBy_Limit.Value;
                requestGroupByIsNull  = false;
            }
            // determine if request.GroupBy should be set to null
            if (requestGroupByIsNull)
            {
                request.GroupBy = null;
            }
            if (cmdletContext.Identifier != null)
            {
                request.Identifier = cmdletContext.Identifier;
            }
            if (cmdletContext.MaxResult != null)
            {
                request.MaxResults = cmdletContext.MaxResult.Value;
            }
            if (cmdletContext.Metric != null)
            {
                request.Metric = cmdletContext.Metric;
            }
            if (cmdletContext.NextToken != null)
            {
                request.NextToken = cmdletContext.NextToken;
            }

            // populate PartitionBy
            var requestPartitionByIsNull = true;

            request.PartitionBy = new Amazon.PI.Model.DimensionGroup();
            List <System.String> requestPartitionBy_partitionBy_Dimension = null;

            if (cmdletContext.PartitionBy_Dimension != null)
            {
                requestPartitionBy_partitionBy_Dimension = cmdletContext.PartitionBy_Dimension;
            }
            if (requestPartitionBy_partitionBy_Dimension != null)
            {
                request.PartitionBy.Dimensions = requestPartitionBy_partitionBy_Dimension;
                requestPartitionByIsNull       = false;
            }
            System.String requestPartitionBy_partitionBy_Group = null;
            if (cmdletContext.PartitionBy_Group != null)
            {
                requestPartitionBy_partitionBy_Group = cmdletContext.PartitionBy_Group;
            }
            if (requestPartitionBy_partitionBy_Group != null)
            {
                request.PartitionBy.Group = requestPartitionBy_partitionBy_Group;
                requestPartitionByIsNull  = false;
            }
            System.Int32?requestPartitionBy_partitionBy_Limit = null;
            if (cmdletContext.PartitionBy_Limit != null)
            {
                requestPartitionBy_partitionBy_Limit = cmdletContext.PartitionBy_Limit.Value;
            }
            if (requestPartitionBy_partitionBy_Limit != null)
            {
                request.PartitionBy.Limit = requestPartitionBy_partitionBy_Limit.Value;
                requestPartitionByIsNull  = false;
            }
            // determine if request.PartitionBy should be set to null
            if (requestPartitionByIsNull)
            {
                request.PartitionBy = null;
            }
            if (cmdletContext.PeriodInSecond != null)
            {
                request.PeriodInSeconds = cmdletContext.PeriodInSecond.Value;
            }
            if (cmdletContext.ServiceType != null)
            {
                request.ServiceType = cmdletContext.ServiceType;
            }
            if (cmdletContext.StartTime != null)
            {
                request.StartTime = cmdletContext.StartTime.Value;
            }

            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);
        }
Example #2
0
 private Amazon.PI.Model.DescribeDimensionKeysResponse CallAWSServiceOperation(IAmazonPI client, Amazon.PI.Model.DescribeDimensionKeysRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Performance Insights", "DescribeDimensionKeys");
     try
     {
         #if DESKTOP
         return(client.DescribeDimensionKeys(request));
         #elif CORECLR
         return(client.DescribeDimensionKeysAsync(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;
     }
 }
 /// <summary>
 /// Paginator for DescribeDimensionKeys operation
 ///</summary>
 public IDescribeDimensionKeysPaginator DescribeDimensionKeys(DescribeDimensionKeysRequest request)
 {
     return(new DescribeDimensionKeysPaginator(this.client, request));
 }