Class: AWS.PI

Inherits:
AWS.Service show all
Identifier:
pi
API Version:
2018-02-27
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Sending a Request Using PI

var pi = new AWS.PI();
pi.describeDimensionKeys(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the PI object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var pi = new AWS.PI({apiVersion: '2018-02-27'});

You can also set the API version globally in AWS.config.apiVersions using the pi service identifier:

AWS.config.apiVersions = {
  pi: '2018-02-27',
  // other service API versions
};

var pi = new AWS.PI();

Version:

  • 2018-02-27

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.PI(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a PI object

var pi = new AWS.PI({apiVersion: '2018-02-27'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com'.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.PI.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.PI.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.PI.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. The base option will be ignored if this option is supplied.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • clientSideMonitoring (Boolean)

    whether to collect and

  • endpointDiscoveryEnabled (Boolean)

    whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by the service. Defaults to 'false'

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

describeDimensionKeys(params = {}, callback) ⇒ AWS.Request

For a specific time period, retrieve the top N dimension keys for a metric.

Service Reference:

Examples:

Calling the describeDimensionKeys operation

var params = {
  EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  GroupBy: { /* required */
    Group: 'STRING_VALUE', /* required */
    Dimensions: [
      'STRING_VALUE',
      /* more items */
    ],
    Limit: 0
  },
  Identifier: 'STRING_VALUE', /* required */
  Metric: 'STRING_VALUE', /* required */
  ServiceType: RDS, /* required */
  StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  Filter: {
    '<String>': 'STRING_VALUE',
    /* '<String>': ... */
  },
  MaxResults: 0,
  NextToken: 'STRING_VALUE',
  PartitionBy: {
    Group: 'STRING_VALUE', /* required */
    Dimensions: [
      'STRING_VALUE',
      /* more items */
    ],
    Limit: 0
  },
  PeriodInSeconds: 0
};
pi.describeDimensionKeys(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ServiceType — (String)

      The AWS service for which Performance Insights will return metrics. The only valid value for ServiceType is: RDS

      Possible values include:
      • "RDS"
    • Identifier — (String)

      An immutable, AWS 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 its DbiResourceId value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A

    • StartTime — (Date)

      The date and time specifying the beginning of the requested time series data. You can't specify a StartTime that's earlier than 7 days ago. The value specified is inclusive - data points equal to or greater than StartTime will be returned.

      The value for StartTime must be earlier than the value for EndTime.

    • EndTime — (Date)

      The date and time specifying the end of the requested time series data. The value specified is exclusive - data points less than (but not equal to) EndTime will be returned.

      The value for EndTime must be later than the value for StartTime.

    • Metric — (String)

      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.

    • PeriodInSeconds — (Integer)

      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 specify PeriodInSeconds, then Performance Insights will choose a value for you, with a goal of returning roughly 100-200 data points in the response.

    • GroupBy — (map)

      A specification for how to aggregate the data points from a query result. You must specify a valid dimension group. Performance Insights will return all of the dimensions within that group, unless you provide the names of specific dimensions within that group. You can also request that Performance Insights return a limited number of values for a dimension.

      • Grouprequired — (String)

        The name of the dimension group. Valid values are:

        • db.user

        • db.host

        • db.sql

        • db.sql_tokenized

        • db.wait_event

        • db.wait_event_type

      • Dimensions — (Array<String>)

        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.user.id

        • db.user.name

        • db.host.id

        • db.host.name

        • db.sql.id

        • db.sql.db_id

        • db.sql.statement

        • db.sql.tokenized_id

        • db.sql_tokenized.id

        • db.sql_tokenized.db_id

        • db.sql_tokenized.statement

        • db.wait_event.name

        • db.wait_event.type

        • db.wait_event_type.name

      • Limit — (Integer)

        The maximum number of items to fetch for this dimension group.

    • PartitionBy — (map)

      For each dimension specified in GroupBy, specify a secondary dimension to further subdivide the partition keys in the response.

      • Grouprequired — (String)

        The name of the dimension group. Valid values are:

        • db.user

        • db.host

        • db.sql

        • db.sql_tokenized

        • db.wait_event

        • db.wait_event_type

      • Dimensions — (Array<String>)

        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.user.id

        • db.user.name

        • db.host.id

        • db.host.name

        • db.sql.id

        • db.sql.db_id

        • db.sql.statement

        • db.sql.tokenized_id

        • db.sql_tokenized.id

        • db.sql_tokenized.db_id

        • db.sql_tokenized.statement

        • db.wait_event.name

        • db.wait_event.type

        • db.wait_event_type.name

      • Limit — (Integer)

        The maximum number of items to fetch for this dimension group.

    • Filter — (map<String>)

      One or more filters to apply in the request. Restrictions:

      • Any number of filters by the same dimension, as specified in the GroupBy or Partition parameters.

      • A single filter for any other dimension in this dimension group.

    • MaxResults — (Integer)

      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.

    • NextToken — (String)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • AlignedStartTime — (Date)

        The start time for the returned dimension keys, after alignment to a granular boundary (as specified by PeriodInSeconds). AlignedStartTime will be less than or equal to the value of the user-specified StartTime.

      • AlignedEndTime — (Date)

        The end time for the returned dimension keys, after alignment to a granular boundary (as specified by PeriodInSeconds). AlignedEndTime will be greater than or equal to the value of the user-specified Endtime.

      • PartitionKeys — (Array<map>)

        If PartitionBy was present in the request, PartitionKeys contains the breakdown of dimension keys by the specified partitions.

        • Dimensionsrequired — (map<String>)

          A dimension map that contains the dimension(s) for this partition.

      • Keys — (Array<map>)

        The dimension keys that were requested.

        • Dimensions — (map<String>)

          A map of name-value pairs for the dimensions in the group.

        • Total — (Float)

          The aggregated metric value for the dimension(s), over the requested time range.

        • Partitions — (Array<Float>)

          If PartitionBy was specified, PartitionKeys contains the dimensions that were.

      • NextToken — (String)

        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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getResourceMetrics(params = {}, callback) ⇒ AWS.Request

Retrieve Performance Insights metrics for a set of data sources, over a time period. You can provide specific dimension groups and dimensions, and provide aggregation and filtering criteria for each group.

Service Reference:

Examples:

Calling the getResourceMetrics operation

var params = {
  EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  Identifier: 'STRING_VALUE', /* required */
  MetricQueries: [ /* required */
    {
      Metric: 'STRING_VALUE', /* required */
      Filter: {
        '<String>': 'STRING_VALUE',
        /* '<String>': ... */
      },
      GroupBy: {
        Group: 'STRING_VALUE', /* required */
        Dimensions: [
          'STRING_VALUE',
          /* more items */
        ],
        Limit: 0
      }
    },
    /* more items */
  ],
  ServiceType: RDS, /* required */
  StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  MaxResults: 0,
  NextToken: 'STRING_VALUE',
  PeriodInSeconds: 0
};
pi.getResourceMetrics(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ServiceType — (String)

      The AWS service for which Performance Insights will return metrics. The only valid value for ServiceType is: RDS

      Possible values include:
      • "RDS"
    • Identifier — (String)

      An immutable, AWS 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 its DbiResourceId value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A

    • MetricQueries — (Array<map>)

      An array of one or more queries to perform. Each query must specify a Performance Insights metric, and can optionally specify aggregation and filtering criteria.

      • Metricrequired — (String)

        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.

      • GroupBy — (map)

        A specification for how to aggregate the data points from a query result. You must specify a valid dimension group. Performance Insights will return all of the dimensions within that group, unless you provide the names of specific dimensions within that group. You can also request that Performance Insights return a limited number of values for a dimension.

        • Grouprequired — (String)

          The name of the dimension group. Valid values are:

          • db.user

          • db.host

          • db.sql

          • db.sql_tokenized

          • db.wait_event

          • db.wait_event_type

        • Dimensions — (Array<String>)

          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.user.id

          • db.user.name

          • db.host.id

          • db.host.name

          • db.sql.id

          • db.sql.db_id

          • db.sql.statement

          • db.sql.tokenized_id

          • db.sql_tokenized.id

          • db.sql_tokenized.db_id

          • db.sql_tokenized.statement

          • db.wait_event.name

          • db.wait_event.type

          • db.wait_event_type.name

        • Limit — (Integer)

          The maximum number of items to fetch for this dimension group.

      • Filter — (map<String>)

        One or more filters to apply in the request. Restrictions:

        • Any number of filters by the same dimension, as specified in the GroupBy parameter.

        • A single filter for any other dimension in this dimension group.

    • StartTime — (Date)

      The date and time specifying the beginning of the requested time series data. You can't specify a StartTime that's earlier than 7 days ago. The value specified is inclusive - data points equal to or greater than StartTime will be returned.

      The value for StartTime must be earlier than the value for EndTime.

    • EndTime — (Date)

      The date and time specifiying the end of the requested time series data. The value specified is exclusive - data points less than (but not equal to) EndTime will be returned.

      The value for EndTime must be later than the value for StartTime.

    • PeriodInSeconds — (Integer)

      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 specify PeriodInSeconds, then Performance Insights will choose a value for you, with a goal of returning roughly 100-200 data points in the response.

    • MaxResults — (Integer)

      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.

    • NextToken — (String)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • AlignedStartTime — (Date)

        The start time for the returned metrics, after alignment to a granular boundary (as specified by PeriodInSeconds). AlignedStartTime will be less than or equal to the value of the user-specified StartTime.

      • AlignedEndTime — (Date)

        The end time for the returned metrics, after alignment to a granular boundary (as specified by PeriodInSeconds). AlignedEndTime will be greater than or equal to the value of the user-specified Endtime.

      • Identifier — (String)

        An immutable, AWS 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 its DbiResourceId value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A

      • MetricList — (Array<map>)

        An array of metric results,, where each array element contains all of the data points for a particular dimension.

        • Key — (map)

          The dimension(s) to which the data points apply.

          • Metricrequired — (String)

            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.

          • Dimensions — (map<String>)

            The valid dimensions for the metric.

        • DataPoints — (Array<map>)

          An array of timestamp-value pairs, representing measurements over a period of time.

          • Timestamprequired — (Date)

            The time, in epoch format, associated with a particular Value.

          • Valuerequired — (Float)

            The actual value associated with a particular Timestamp.

      • NextToken — (String)

        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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.