Skip to content

/AWS1/CL_IOT=>CREATECUSTOMMETRIC()

About CreateCustomMetric

Use this API to define a Custom Metric published by your devices to Device Defender.

Requires permission to access the CreateCustomMetric action.

Method Signature

IMPORTING

Required arguments:

iv_metricname TYPE /AWS1/IOTMETRICNAME /AWS1/IOTMETRICNAME

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.

iv_metrictype TYPE /AWS1/IOTCUSTOMMETRICTYPE /AWS1/IOTCUSTOMMETRICTYPE

The type of the custom metric.

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.

iv_clientrequesttoken TYPE /AWS1/IOTCLIENTREQUESTTOKEN /AWS1/IOTCLIENTREQUESTTOKEN

Each custom metric must have a unique client request token. If you try to create a new custom metric that already exists with a different token, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.

Optional arguments:

iv_displayname TYPE /AWS1/IOTCUSTOMMETRICDSPNAME /AWS1/IOTCUSTOMMETRICDSPNAME

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.

it_tags TYPE /AWS1/CL_IOTTAG=>TT_TAGLIST TT_TAGLIST

Metadata that can be used to manage the custom metric.

RETURNING

oo_output TYPE REF TO /aws1/cl_iotcrecustmetricrsp /AWS1/CL_IOTCRECUSTMETRICRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_iot~createcustommetric(
  it_tags = VALUE /aws1/cl_iottag=>tt_taglist(
    (
      new /aws1/cl_iottag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  iv_clientrequesttoken = |string|
  iv_displayname = |string|
  iv_metricname = |string|
  iv_metrictype = |string|
).

This is an example of reading all possible response values

lv_metricname = lo_result->get_metricname( ).
lv_custommetricarn = lo_result->get_metricarn( ).