Skip to content

/AWS1/CL_ECS=>PUTATTRIBUTES()

About PutAttributes

Create or update an attribute on an Amazon ECS resource. If the attribute doesn't exist, it's created. If the attribute exists, its value is replaced with the specified value. To delete an attribute, use DeleteAttributes. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide.

Method Signature

IMPORTING

Required arguments:

it_attributes TYPE /AWS1/CL_ECSATTRIBUTE=>TT_ATTRIBUTES TT_ATTRIBUTES

The attributes to apply to your resource. You can specify up to 10 custom attributes for each resource. You can specify up to 10 attributes in a single call.

Optional arguments:

iv_cluster TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The short name or full Amazon Resource Name (ARN) of the cluster that contains the resource to apply attributes. If you do not specify a cluster, the default cluster is assumed.

RETURNING

oo_output TYPE REF TO /aws1/cl_ecsputattrsresponse /AWS1/CL_ECSPUTATTRSRESPONSE

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_ecs~putattributes(
  it_attributes = VALUE /aws1/cl_ecsattribute=>tt_attributes(
    (
      new /aws1/cl_ecsattribute(
        iv_name = |string|
        iv_targetid = |string|
        iv_targettype = |string|
        iv_value = |string|
      )
    )
  )
  iv_cluster = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_attributes( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_string = lo_row_1->get_name( ).
      lv_string = lo_row_1->get_value( ).
      lv_targettype = lo_row_1->get_targettype( ).
      lv_string = lo_row_1->get_targetid( ).
    ENDIF.
  ENDLOOP.
ENDIF.

To create or update an attribute on a resource

This example adds an attribute "stack" with the value "production" to a container instance.

DATA(lo_result) = lo_client->/aws1/if_ecs~putattributes(
  it_attributes = VALUE /aws1/cl_ecsattribute=>tt_attributes(
    (
      new /aws1/cl_ecsattribute(
        iv_name = |stack|
        iv_targetid = |arn:aws:ecs:us-west-2:123456789012:container-instance/1c3be8ed-df30-47b4-8f1e-6e68ebd01f34|
        iv_value = |production|
      )
    )
  )
  iv_cluster = |MyCluster|
).