/*******************************************************************************
 *  Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *  Licensed under the Apache License, Version 2.0 (the "License"). You may not use
 *  this file except in compliance with the License. A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 *  or in the "license" file accompanying this file.
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the
 *  specific language governing permissions and limitations under the License.
 * *****************************************************************************
 *
 *  AWS Tools for Windows (TM) PowerShell (TM)
 *
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Amazon.PowerShell.Common;
using Amazon.Runtime;
using Amazon.PI;
using Amazon.PI.Model;
namespace Amazon.PowerShell.Cmdlets.PI
{
    /// 
    /// For a specific time period, retrieve the top N dimension keys for a metric.
    /// 
    /// 
    ///  
    /// Each response element returns a maximum of 500 bytes. For larger elements, such as
    /// SQL statements, only the first 500 bytes are returned.
    /// 
    /// 
    [Cmdlet("Get", "PIDimensionKey")]
    [OutputType("Amazon.PI.Model.DescribeDimensionKeysResponse")]
    [AWSCmdlet("Calls the AWS Performance Insights DescribeDimensionKeys API operation.", Operation = new[] {"DescribeDimensionKeys"}, SelectReturnType = typeof(Amazon.PI.Model.DescribeDimensionKeysResponse))]
    [AWSCmdletOutput("Amazon.PI.Model.DescribeDimensionKeysResponse",
        "This cmdlet returns an Amazon.PI.Model.DescribeDimensionKeysResponse object containing multiple properties. The object can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
    )]
    public partial class GetPIDimensionKeyCmdlet : AmazonPIClientCmdlet, IExecutor
    {
        
        #region Parameter AdditionalMetric
        /// 
        /// 
        /// Additional metrics for the top N dimension keys. If the specified dimension
        /// group in the GroupBy parameter is db.sql_tokenized, you
        /// can specify per-SQL metrics to get the values for the top N SQL digests.
        /// The response syntax is as follows: "AdditionalMetrics" : { "string" :
        /// "string" }. 
        /// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        [Alias("AdditionalMetrics")]
        public System.String[] AdditionalMetric { get; set; }
        #endregion
        
        #region Parameter GroupBy_Dimension
        /// 
        /// 
        /// A list of specific dimensions from a dimension group. If this parameter is not present,
        /// then it signifies that all of the dimensions in the group were requested, or are present
        /// in the response.Valid values for elements in the Dimensions array are:- db.application.name- The name of the application that is connected
        /// to the database. Valid values are as follows:- Aurora PostgreSQL
- Amazon RDS PostgreSQL
- Amazon DocumentDB
 
- db.host.id- The host ID of the connected client (all engines).
- db.host.name- The host name of the connected client (all engines).
- db.name- The name of the database to which the client is connected.
        /// Valid values are as follows:- Aurora PostgreSQL
- Amazon RDS PostgreSQL
- Aurora MySQL
- Amazon RDS MySQL
- Amazon RDS MariaDB
- Amazon DocumentDB
 
- db.query.id- The query ID generated by Performance Insights (only Amazon
        /// DocumentDB).
- db.query.db_id- The query ID generated by the database (only Amazon
        /// DocumentDB).
- db.query.statement- The text of the query that is being run (only Amazon
        /// DocumentDB).
- db.query.tokenized_id
- db.query.tokenized.id- The query digest ID generated by Performance
        /// Insights (only Amazon DocumentDB).
- db.query.tokenized.db_id- The query digest ID generated by Performance
        /// Insights (only Amazon DocumentDB).
- db.query.tokenized.statement- The text of the query digest (only Amazon
        /// DocumentDB).
- db.session_type.name- The type of the current session (only Amazon
        /// DocumentDB).
- db.sql.id- The hash of the full, non-tokenized SQL statement generated
        /// by Performance Insights (all engines except Amazon DocumentDB).
- db.sql.db_id- Either the SQL ID generated by the database engine, or
        /// a value generated by Performance Insights that begins with- pi-(all engines
        /// except Amazon DocumentDB).
- db.sql.statement- The full text of the SQL statement that is running,
        /// as in- SELECT * FROM employees(all engines except Amazon DocumentDB)
- db.sql.tokenized_id
- db.sql_tokenized.id- The hash of the SQL digest generated by Performance
        /// Insights (all engines except Amazon DocumentDB). In the console,- db.sql_tokenized.id/// is called the Support ID because Amazon Web Services Support can look at this data
        /// to help you troubleshoot database issues.
- db.sql_tokenized.db_id- Either the native database ID used to refer
        /// to the SQL statement, or a synthetic ID such as- pi-2372568224that Performance
        /// Insights generates if the native database ID isn't available (all engines except Amazon
        /// DocumentDB).
- db.sql_tokenized.statement- The text of the SQL digest, as in- SELECT
        /// * FROM employees WHERE employee_id = ?(all engines except Amazon DocumentDB)
- db.user.id- The ID of the user logged in to the database (all engines
        /// except Amazon DocumentDB).
- db.user.name- The name of the user logged in to the database (all engines
        /// except Amazon DocumentDB).
- db.wait_event.name- The event for which the backend is waiting (all
        /// engines except Amazon DocumentDB).
- db.wait_event.type- The type of event for which the backend is waiting
        /// (all engines except Amazon DocumentDB).
- db.wait_event_type.name- The name of the event type for which the backend
        /// is waiting (all engines except Amazon DocumentDB).
- db.wait_state.name- The event for which the backend is waiting (only
        /// Amazon DocumentDB).
/// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        [Alias("GroupBy_Dimensions")]
        public System.String[] GroupBy_Dimension { get; set; }
        #endregion
        
        #region Parameter PartitionBy_Dimension
        /// 
        /// 
        /// A list of specific dimensions from a dimension group. If this parameter is not present,
        /// then it signifies that all of the dimensions in the group were requested, or are present
        /// in the response.Valid values for elements in theDimensions array are:- db.application.name- The name of the application that is connected
        /// to the database. Valid values are as follows:- Aurora PostgreSQL
- Amazon RDS PostgreSQL
- Amazon DocumentDB
 
- db.host.id- The host ID of the connected client (all engines).
- db.host.name- The host name of the connected client (all engines).
- db.name- The name of the database to which the client is connected.
        /// Valid values are as follows:- Aurora PostgreSQL
- Amazon RDS PostgreSQL
- Aurora MySQL
- Amazon RDS MySQL
- Amazon RDS MariaDB
- Amazon DocumentDB
 
- db.query.id- The query ID generated by Performance Insights (only Amazon
        /// DocumentDB).
- db.query.db_id- The query ID generated by the database (only Amazon
        /// DocumentDB).
- db.query.statement- The text of the query that is being run (only Amazon
        /// DocumentDB).
- db.query.tokenized_id
- db.query.tokenized.id- The query digest ID generated by Performance
        /// Insights (only Amazon DocumentDB).
- db.query.tokenized.db_id- The query digest ID generated by Performance
        /// Insights (only Amazon DocumentDB).
- db.query.tokenized.statement- The text of the query digest (only Amazon
        /// DocumentDB).
- db.session_type.name- The type of the current session (only Amazon
        /// DocumentDB).
- db.sql.id- The hash of the full, non-tokenized SQL statement generated
        /// by Performance Insights (all engines except Amazon DocumentDB).
- db.sql.db_id- Either the SQL ID generated by the database engine, or
        /// a value generated by Performance Insights that begins with- pi-(all engines
        /// except Amazon DocumentDB).
- db.sql.statement- The full text of the SQL statement that is running,
        /// as in- SELECT * FROM employees(all engines except Amazon DocumentDB)
- db.sql.tokenized_id
- db.sql_tokenized.id- The hash of the SQL digest generated by Performance
        /// Insights (all engines except Amazon DocumentDB). In the console,- db.sql_tokenized.id/// is called the Support ID because Amazon Web Services Support can look at this data
        /// to help you troubleshoot database issues.
- db.sql_tokenized.db_id- Either the native database ID used to refer
        /// to the SQL statement, or a synthetic ID such as- pi-2372568224that Performance
        /// Insights generates if the native database ID isn't available (all engines except Amazon
        /// DocumentDB).
- db.sql_tokenized.statement- The text of the SQL digest, as in- SELECT
        /// * FROM employees WHERE employee_id = ?(all engines except Amazon DocumentDB)
- db.user.id- The ID of the user logged in to the database (all engines
        /// except Amazon DocumentDB).
- db.user.name- The name of the user logged in to the database (all engines
        /// except Amazon DocumentDB).
- db.wait_event.name- The event for which the backend is waiting (all
        /// engines except Amazon DocumentDB).
- db.wait_event.type- The type of event for which the backend is waiting
        /// (all engines except Amazon DocumentDB).
- db.wait_event_type.name- The name of the event type for which the backend
        /// is waiting (all engines except Amazon DocumentDB).
- db.wait_state.name- The event for which the backend is waiting (only
        /// Amazon DocumentDB).
/// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        [Alias("PartitionBy_Dimensions")]
        public System.String[] PartitionBy_Dimension { get; set; }
        #endregion
        
        #region Parameter EndTime
        /// 
        /// 
        /// The date and time specifying the end of the requested time series data. The value
        /// specified is exclusive, which means that data points less than (but not equal
        /// to)EndTime are returned.The value for EndTime must be later than the value for StartTime.
        /// 
        /// 
        #if !MODULAR
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        #else
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
        [System.Management.Automation.AllowNull]
        #endif
        [Amazon.PowerShell.Common.AWSRequiredParameter]
        public System.DateTime? EndTime { get; set; }
        #endregion
        
        #region Parameter Filter
        /// 
        /// 
        /// One or more filters to apply in the request. Restrictions:- Any number of filters by the same dimension, as specified in the GroupBy/// orPartitionparameters.
- A single filter for any other dimension in this dimension group.
/// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        public System.Collections.Hashtable Filter { get; set; }
        #endregion
        
        #region Parameter GroupBy_Group
        /// 
        /// 
        /// The name of the dimension group. Valid values are as follows:- db- The name of the database to which the client is connected. The
        /// following values are permitted:- Aurora PostgreSQL
- Amazon RDS PostgreSQL
- Aurora MySQL
- Amazon RDS MySQL
- Amazon RDS MariaDB
- Amazon DocumentDB
 
- db.application- The name of the application that is connected to the
        /// database. The following values are permitted:- Aurora PostgreSQL
- Amazon RDS PostgreSQL
- Amazon DocumentDB
 
- db.host- The host name of the connected client (all engines).
- db.query- The query that is currently running (only Amazon DocumentDB).
- db.query_tokenized- The digest query (only Amazon DocumentDB).
- db.session_type- The type of the current session (only Aurora PostgreSQL
        /// and RDS PostgreSQL).
- db.sql- The text of the SQL statement that is currently running (all
        /// engines except Amazon DocumentDB).
- db.sql_tokenized- The SQL digest (all engines except Amazon DocumentDB).
- db.user- The user logged in to the database (all engines except Amazon
        /// DocumentDB).
- db.wait_event- The event for which the database backend is waiting
        /// (all engines except Amazon DocumentDB).
- db.wait_event_type- The type of event for which the database backend
        /// is waiting (all engines except Amazon DocumentDB).
- db.wait_state- The event for which the database backend is waiting
        /// (only Amazon DocumentDB).
/// 
        /// 
        #if !MODULAR
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        #else
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
        [System.Management.Automation.AllowEmptyString]
        [System.Management.Automation.AllowNull]
        #endif
        [Amazon.PowerShell.Common.AWSRequiredParameter]
        public System.String GroupBy_Group { get; set; }
        #endregion
        
        #region Parameter PartitionBy_Group
        /// 
        /// 
        /// The name of the dimension group. Valid values are as follows:- db- The name of the database to which the client is connected. The
        /// following values are permitted:- Aurora PostgreSQL
- Amazon RDS PostgreSQL
- Aurora MySQL
- Amazon RDS MySQL
- Amazon RDS MariaDB
- Amazon DocumentDB
 
- db.application- The name of the application that is connected to the
        /// database. The following values are permitted:- Aurora PostgreSQL
- Amazon RDS PostgreSQL
- Amazon DocumentDB
 
- db.host- The host name of the connected client (all engines).
- db.query- The query that is currently running (only Amazon DocumentDB).
- db.query_tokenized- The digest query (only Amazon DocumentDB).
- db.session_type- The type of the current session (only Aurora PostgreSQL
        /// and RDS PostgreSQL).
- db.sql- The text of the SQL statement that is currently running (all
        /// engines except Amazon DocumentDB).
- db.sql_tokenized- The SQL digest (all engines except Amazon DocumentDB).
- db.user- The user logged in to the database (all engines except Amazon
        /// DocumentDB).
- db.wait_event- The event for which the database backend is waiting
        /// (all engines except Amazon DocumentDB).
- db.wait_event_type- The type of event for which the database backend
        /// is waiting (all engines except Amazon DocumentDB).
- db.wait_state- The event for which the database backend is waiting
        /// (only Amazon DocumentDB).
/// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        public System.String PartitionBy_Group { get; set; }
        #endregion
        
        #region Parameter Identifier
        /// 
        /// 
        /// An immutable, Amazon Web Services Region-unique identifier for a data source. Performance
        /// Insights gathers metrics from this data source.To use an Amazon RDS instance as a data source, you specify itsDbiResourceId
        /// value. For example, specify db-FAIHNTYBKTGAUSUZQYPDS2GW4A. 
        /// 
        /// 
        #if !MODULAR
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        #else
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
        [System.Management.Automation.AllowEmptyString]
        [System.Management.Automation.AllowNull]
        #endif
        [Amazon.PowerShell.Common.AWSRequiredParameter]
        public System.String Identifier { get; set; }
        #endregion
        
        #region Parameter GroupBy_Limit
        /// 
        /// 
        /// The maximum number of items to fetch for this dimension group.
        /// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        public System.Int32? GroupBy_Limit { get; set; }
        #endregion
        
        #region Parameter PartitionBy_Limit
        /// 
        /// 
        /// The maximum number of items to fetch for this dimension group.
        /// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        public System.Int32? PartitionBy_Limit { get; set; }
        #endregion
        
        #region Parameter Metric
        /// 
        /// 
        /// The name of a Performance Insights metric to be measured.Valid values for Metric are:- db.load.avg- A scaled representation of the number of active sessions
        /// for the database engine.
- db.sampledload.avg- The raw number of active sessions for the database
        /// engine.
If the number of active sessions is less than an internal Performance Insights threshold,
        ///db.load.avg and db.sampledload.avg are the same value. If
        /// the number of active sessions is greater than the internal threshold, Performance
        /// Insights samples the active sessions, with db.load.avg showing the scaled
        /// values, db.sampledload.avg showing the raw values, and db.sampledload.avg
        /// less than db.load.avg. For most use cases, you can query db.load.avg
        /// only. 
        /// 
        /// 
        #if !MODULAR
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        #else
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
        [System.Management.Automation.AllowEmptyString]
        [System.Management.Automation.AllowNull]
        #endif
        [Amazon.PowerShell.Common.AWSRequiredParameter]
        public System.String Metric { get; set; }
        #endregion
        
        #region Parameter PeriodInSecond
        /// 
        /// 
        /// The granularity, in seconds, of the data points returned from Performance Insights.
        /// A period can be as short as one second, or as long as one day (86400 seconds). Valid
        /// values are: - 1(one second)
- 60(one minute)
- 300(five minutes)
- 3600(one hour)
- 86400(twenty-four hours)
If you don't specifyPeriodInSeconds, then Performance Insights chooses
        /// a value for you, with a goal of returning roughly 100-200 data points in the response.
        /// 
        /// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        [Alias("PeriodInSeconds")]
        public System.Int32? PeriodInSecond { get; set; }
        #endregion
        
        #region Parameter ServiceType
        /// 
        /// 
        /// The Amazon Web Services service for which Performance Insights will return metrics.
        /// Valid values are as follows:
        /// 
        /// 
        #if !MODULAR
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        #else
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
        [System.Management.Automation.AllowNull]
        #endif
        [Amazon.PowerShell.Common.AWSRequiredParameter]
        [AWSConstantClassSource("Amazon.PI.ServiceType")]
        public Amazon.PI.ServiceType ServiceType { get; set; }
        #endregion
        
        #region Parameter StartTime
        /// 
        /// 
        /// The date and time specifying the beginning of the requested time series data. You
        /// must specify a StartTime within the past 7 days. The value specified
        /// is inclusive, which means that data points equal to or greater than StartTime
        /// are returned. The value for StartTime must be earlier than the value for EndTime.
        /// 
        /// 
        /// 
        #if !MODULAR
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        #else
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
        [System.Management.Automation.AllowNull]
        #endif
        [Amazon.PowerShell.Common.AWSRequiredParameter]
        public System.DateTime? StartTime { get; set; }
        #endregion
        
        #region Parameter MaxResult
        /// 
        /// 
        /// The maximum number of items to return in the response. If more items exist than the
        /// specified MaxRecords value, a pagination token is included in the response
        /// so that the remaining results can be retrieved. 
        /// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        [Alias("MaxResults")]
        public System.Int32? MaxResult { get; set; }
        #endregion
        
        #region Parameter NextToken
        /// 
        /// 
        /// An optional pagination token provided by a previous request. If this parameter is
        /// specified, the response includes only records beyond the token, up to the value specified
        /// by MaxRecords.
        /// 
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        public System.String NextToken { get; set; }
        #endregion
        
        #region Parameter Select
        /// 
        /// Use the -Select parameter to control the cmdlet output. The default value is '*'.
        /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.PI.Model.DescribeDimensionKeysResponse).
        /// Specifying the name of a property of type Amazon.PI.Model.DescribeDimensionKeysResponse will result in that property being returned.
        /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
        /// 
        [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
        public string Select { get; set; } = "*";
        #endregion
        
        protected override void ProcessRecord()
        {
            this._AWSSignerType = "v4";
            base.ProcessRecord();
            
            var context = new CmdletContext();
            
            // allow for manipulation of parameters prior to loading into context
            PreExecutionContextLoad(context);
            
            if (ParameterWasBound(nameof(this.Select)))
            {
                context.Select = CreateSelectDelegate(Select) ??
                    throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
            }
            if (this.AdditionalMetric != null)
            {
                context.AdditionalMetric = new List(this.AdditionalMetric);
            }
            context.EndTime = this.EndTime;
            #if MODULAR
            if (this.EndTime == null && ParameterWasBound(nameof(this.EndTime)))
            {
                WriteWarning("You are passing $null as a value for parameter EndTime which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
            }
            #endif
            if (this.Filter != null)
            {
                context.Filter = new Dictionary(StringComparer.Ordinal);
                foreach (var hashKey in this.Filter.Keys)
                {
                    context.Filter.Add((String)hashKey, (String)(this.Filter[hashKey]));
                }
            }
            if (this.GroupBy_Dimension != null)
            {
                context.GroupBy_Dimension = new List(this.GroupBy_Dimension);
            }
            context.GroupBy_Group = this.GroupBy_Group;
            #if MODULAR
            if (this.GroupBy_Group == null && ParameterWasBound(nameof(this.GroupBy_Group)))
            {
                WriteWarning("You are passing $null as a value for parameter GroupBy_Group which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
            }
            #endif
            context.GroupBy_Limit = this.GroupBy_Limit;
            context.Identifier = this.Identifier;
            #if MODULAR
            if (this.Identifier == null && ParameterWasBound(nameof(this.Identifier)))
            {
                WriteWarning("You are passing $null as a value for parameter Identifier which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
            }
            #endif
            context.MaxResult = this.MaxResult;
            context.Metric = this.Metric;
            #if MODULAR
            if (this.Metric == null && ParameterWasBound(nameof(this.Metric)))
            {
                WriteWarning("You are passing $null as a value for parameter Metric which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
            }
            #endif
            context.NextToken = this.NextToken;
            if (this.PartitionBy_Dimension != null)
            {
                context.PartitionBy_Dimension = new List(this.PartitionBy_Dimension);
            }
            context.PartitionBy_Group = this.PartitionBy_Group;
            context.PartitionBy_Limit = this.PartitionBy_Limit;
            context.PeriodInSecond = this.PeriodInSecond;
            context.ServiceType = this.ServiceType;
            #if MODULAR
            if (this.ServiceType == null && ParameterWasBound(nameof(this.ServiceType)))
            {
                WriteWarning("You are passing $null as a value for parameter ServiceType which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
            }
            #endif
            context.StartTime = this.StartTime;
            #if MODULAR
            if (this.StartTime == null && ParameterWasBound(nameof(this.StartTime)))
            {
                WriteWarning("You are passing $null as a value for parameter StartTime which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
            }
            #endif
            
            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);
            
            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        
        #region IExecutor Members
        
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.PI.Model.DescribeDimensionKeysRequest();
            
            if (cmdletContext.AdditionalMetric != null)
            {
                request.AdditionalMetrics = cmdletContext.AdditionalMetric;
            }
            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 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 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;
        }
        
        public ExecutorContext CreateContext()
        {
            return new CmdletContext();
        }
        
        #endregion
        
        #region AWS Service Operation Call
        
        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;
            }
        }
        
        #endregion
        
        internal partial class CmdletContext : ExecutorContext
        {
            public List AdditionalMetric { get; set; }
            public System.DateTime? EndTime { get; set; }
            public Dictionary Filter { get; set; }
            public List GroupBy_Dimension { get; set; }
            public System.String GroupBy_Group { get; set; }
            public System.Int32? GroupBy_Limit { get; set; }
            public System.String Identifier { get; set; }
            public System.Int32? MaxResult { get; set; }
            public System.String Metric { get; set; }
            public System.String NextToken { get; set; }
            public List PartitionBy_Dimension { get; set; }
            public System.String PartitionBy_Group { get; set; }
            public System.Int32? PartitionBy_Limit { get; set; }
            public System.Int32? PeriodInSecond { get; set; }
            public Amazon.PI.ServiceType ServiceType { get; set; }
            public System.DateTime? StartTime { get; set; }
            public System.Func Select { get; set; } =
                (response, cmdlet) => response;
        }
        
    }
}