Skip to content
v2.273.0

SearchComponents Struct ​

Search components for use with {@link Values.fromSearchComponents}.

Example ​

ts
import * as cw from 'aws-cdk-lib/aws-cloudwatch';

const dashboard = new cw.Dashboard(this, 'Dash', {
  defaultInterval: Duration.days(7),
  variables: [new cw.DashboardVariable({
    id: 'functionName',
    type: cw.VariableType.PATTERN,
    label: 'Function',
    inputType: cw.VariableInputType.RADIO,
    value: 'originalFuncNameInDashboard',
    // equivalent to cw.Values.fromSearch('{AWS/Lambda,FunctionName} MetricName=\"Duration\"', 'FunctionName')
    values: cw.Values.fromSearchComponents({
      namespace: 'AWS/Lambda',
      dimensions: ['FunctionName'],
      metricName: 'Duration',
      populateFrom: 'FunctionName',
    }),
    defaultValue: cw.DefaultValue.FIRST,
    visible: true,
  })],
});

Properties ​

dimensionsstring[]dimensionstyping.List[str]dimensionsList<String>Dimensionsstring[]Dimensions*[]*stringrequired#
The list of dimensions to be used in the search expression.
metricNamestringmetric_namestrmetricNameStringMetricNamestringMetricName*stringrequired#
The metric name to be used in the search expression.
namespacestringnamespacestrnamespaceStringNamespacestringNamespace*stringrequired#
The namespace to be used in the search expression.
populateFromstringpopulate_fromstrpopulateFromStringPopulateFromstringPopulateFrom*stringrequired#
The dimension name, that the search expression retrieves, whose values will be used to populate the values to choose from.