Class: AWSCDK::IoT::CfnCustomMetricProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
io_t/cfn_custom_metric_props.rb

Overview

Properties for defining a CfnCustomMetric.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric_type:, display_name: nil, metric_name: nil, tags: nil) ⇒ CfnCustomMetricProps

Returns a new instance of CfnCustomMetricProps.

Parameters:

  • metric_type (String)

    The type of the custom metric. Types include string-list , ip-address-list , number-list , and number .

  • display_name (String, nil) (defaults to: nil)

    The friendly name in the console for the custom metric.

  • metric_name (String, nil) (defaults to: nil)

    The name of the custom metric.

  • tags (Array<AWSCDK::CfnTag>, nil) (defaults to: nil)

    Metadata that can be used to manage the custom metric.



13
14
15
16
17
18
19
20
21
22
# File 'io_t/cfn_custom_metric_props.rb', line 13

def initialize(metric_type:, display_name: nil, metric_name: nil, tags: nil)
  @metric_type = metric_type
  Jsii::Type.check_type(@metric_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricType")
  @display_name = display_name
  Jsii::Type.check_type(@display_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "displayName") unless @display_name.nil?
  @metric_name = metric_name
  Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName") unless @metric_name.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
end

Instance Attribute Details

#display_nameString? (readonly)

The friendly name in the console for the custom metric.

This name doesn't have to be unique. Don't use this name as the metric identifier in the device metric report. You can update the friendly name after you define it.



37
38
39
# File 'io_t/cfn_custom_metric_props.rb', line 37

def display_name
  @display_name
end

#metric_nameString? (readonly)

The name of the custom metric.

This will be used in the metric report submitted from the device/thing. The name can't begin with aws: . You can’t change the name after you define it.



44
45
46
# File 'io_t/cfn_custom_metric_props.rb', line 44

def metric_name
  @metric_name
end

#metric_typeString (readonly)

The type of the custom metric. Types include string-list , ip-address-list , number-list , and number .

The type number only takes a single metric value as an input, but when you submit the metrics value in the DeviceMetrics report, you must pass it as an array with a single value.



30
31
32
# File 'io_t/cfn_custom_metric_props.rb', line 30

def metric_type
  @metric_type
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

Metadata that can be used to manage the custom metric.



49
50
51
# File 'io_t/cfn_custom_metric_props.rb', line 49

def tags
  @tags
end

Class Method Details

.jsii_propertiesObject



51
52
53
54
55
56
57
58
# File 'io_t/cfn_custom_metric_props.rb', line 51

def self.jsii_properties
  {
    :metric_type => "metricType",
    :display_name => "displayName",
    :metric_name => "metricName",
    :tags => "tags",
  }
end

Instance Method Details

#to_jsiiObject



60
61
62
63
64
65
66
67
68
69
# File 'io_t/cfn_custom_metric_props.rb', line 60

def to_jsii
  result = {}
  result.merge!({
    "metricType" => @metric_type,
    "displayName" => @display_name,
    "metricName" => @metric_name,
    "tags" => @tags,
  })
  result.compact
end