Skip to content

/AWS1/IF_LSA=>UPDATEBUCKET()

About UpdateBucket

Updates an existing Amazon Lightsail bucket.

Use this action to update the configuration of an existing bucket, such as versioning, public accessibility, and the Amazon Web Services accounts that can access the bucket.

Method Signature

METHODS /AWS1/IF_LSA~UPDATEBUCKET
  IMPORTING
    !IV_BUCKETNAME TYPE /AWS1/LSABUCKETNAME OPTIONAL
    !IO_ACCESSRULES TYPE REF TO /AWS1/CL_LSAACCESSRULES OPTIONAL
    !IV_VERSIONING TYPE /AWS1/LSANONEMPTYSTRING OPTIONAL
    !IT_READONLYACCESSACCOUNTS TYPE /AWS1/CL_LSAPARTNERIDLIST_W=>TT_PARTNERIDLIST OPTIONAL
    !IO_ACCESSLOGCONFIG TYPE REF TO /AWS1/CL_LSABKTACCESSLOGCONFIG OPTIONAL
    !IO_CORS TYPE REF TO /AWS1/CL_LSABUCKETCORSCONFIG OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_lsaupdatebucketresult
  RAISING
    /AWS1/CX_LSAACCESSDENIEDEX
    /AWS1/CX_LSAINVALIDINPUTEX
    /AWS1/CX_LSANOTFOUNDEXCEPTION
    /AWS1/CX_LSARGNSETUPINPRGSSEX
    /AWS1/CX_LSASERVICEEXCEPTION
    /AWS1/CX_LSAUNAUTHNTCTDEX
    /AWS1/CX_LSACLIENTEXC
    /AWS1/CX_LSASERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_bucketname TYPE /AWS1/LSABUCKETNAME /AWS1/LSABUCKETNAME

The name of the bucket to update.

Optional arguments:

io_accessrules TYPE REF TO /AWS1/CL_LSAACCESSRULES /AWS1/CL_LSAACCESSRULES

An object that sets the public accessibility of objects in the specified bucket.

iv_versioning TYPE /AWS1/LSANONEMPTYSTRING /AWS1/LSANONEMPTYSTRING

Specifies whether to enable or suspend versioning of objects in the bucket.

The following options can be specified:

  • Enabled - Enables versioning of objects in the specified bucket.

  • Suspended - Suspends versioning of objects in the specified bucket. Existing object versions are retained.

it_readonlyaccessaccounts TYPE /AWS1/CL_LSAPARTNERIDLIST_W=>TT_PARTNERIDLIST TT_PARTNERIDLIST

An array of strings to specify the Amazon Web Services account IDs that can access the bucket.

You can give a maximum of 10 Amazon Web Services accounts access to a bucket.

io_accesslogconfig TYPE REF TO /AWS1/CL_LSABKTACCESSLOGCONFIG /AWS1/CL_LSABKTACCESSLOGCONFIG

An object that describes the access log configuration for the bucket.

io_cors TYPE REF TO /AWS1/CL_LSABUCKETCORSCONFIG /AWS1/CL_LSABUCKETCORSCONFIG

Sets the cross-origin resource sharing (CORS) configuration for your bucket. If a CORS configuration exists, it is replaced with the specified configuration. For AWS CLI operations, this parameter can also be passed as a file. For more information, see Configuring cross-origin resource sharing (CORS).

CORS information is only returned in a response when you update the CORS policy.

RETURNING

oo_output TYPE REF TO /aws1/cl_lsaupdatebucketresult /AWS1/CL_LSAUPDATEBUCKETRESULT

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->updatebucket(
  io_accesslogconfig = new /aws1/cl_lsabktaccesslogconfig(
    iv_destination = |string|
    iv_enabled = ABAP_TRUE
    iv_prefix = |string|
  )
  io_accessrules = new /aws1/cl_lsaaccessrules(
    iv_allowpublicoverrides = ABAP_TRUE
    iv_getobject = |string|
  )
  io_cors = new /aws1/cl_lsabucketcorsconfig(
    it_rules = VALUE /aws1/cl_lsabucketcorsrule=>tt_bucketcorsrules(
      (
        new /aws1/cl_lsabucketcorsrule(
          it_allowedheaders = VALUE /aws1/cl_lsabktcorsalwdheade00=>tt_bucketcorsallowedheaders(
            ( new /aws1/cl_lsabktcorsalwdheade00( |string| ) )
          )
          it_allowedmethods = VALUE /aws1/cl_lsabktcorsalwdmeths_w=>tt_bucketcorsallowedmethods(
            ( new /aws1/cl_lsabktcorsalwdmeths_w( |string| ) )
          )
          it_allowedorigins = VALUE /aws1/cl_lsabktcorsalwdorigi00=>tt_bucketcorsallowedorigins(
            ( new /aws1/cl_lsabktcorsalwdorigi00( |string| ) )
          )
          it_exposeheaders = VALUE /aws1/cl_lsabktcorsexposehea00=>tt_bucketcorsexposeheaders(
            ( new /aws1/cl_lsabktcorsexposehea00( |string| ) )
          )
          iv_id = |string|
          iv_maxageseconds = 123
        )
      )
    )
  )
  it_readonlyaccessaccounts = VALUE /aws1/cl_lsapartneridlist_w=>tt_partneridlist(
    ( new /aws1/cl_lsapartneridlist_w( |string| ) )
  )
  iv_bucketname = |string|
  iv_versioning = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_bucket = lo_result->get_bucket( ).
  IF lo_bucket IS NOT INITIAL.
    lv_nonemptystring = lo_bucket->get_resourcetype( ).
    lo_accessrules = lo_bucket->get_accessrules( ).
    IF lo_accessrules IS NOT INITIAL.
      lv_accesstype = lo_accessrules->get_getobject( ).
      lv_boolean = lo_accessrules->get_allowpublicoverrides( ).
    ENDIF.
    lv_nonemptystring = lo_bucket->get_arn( ).
    lv_nonemptystring = lo_bucket->get_bundleid( ).
    lv_isodate = lo_bucket->get_createdat( ).
    lv_nonemptystring = lo_bucket->get_url( ).
    lo_resourcelocation = lo_bucket->get_location( ).
    IF lo_resourcelocation IS NOT INITIAL.
      lv_string = lo_resourcelocation->get_availabilityzone( ).
      lv_regionname = lo_resourcelocation->get_regionname( ).
    ENDIF.
    lv_bucketname = lo_bucket->get_name( ).
    lv_nonemptystring = lo_bucket->get_supportcode( ).
    LOOP AT lo_bucket->get_tags( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_tagkey = lo_row_1->get_key( ).
        lv_tagvalue = lo_row_1->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_nonemptystring = lo_bucket->get_objectversioning( ).
    lv_boolean = lo_bucket->get_abletoupdatebundle( ).
    LOOP AT lo_bucket->get_readonlyaccessaccounts( ) into lo_row_2.
      lo_row_3 = lo_row_2.
      IF lo_row_3 IS NOT INITIAL.
        lv_nonemptystring = lo_row_3->get_value( ).
      ENDIF.
    ENDLOOP.
    LOOP AT lo_bucket->get_resourcesreceivingaccess( ) into lo_row_4.
      lo_row_5 = lo_row_4.
      IF lo_row_5 IS NOT INITIAL.
        lv_nonemptystring = lo_row_5->get_name( ).
        lv_nonemptystring = lo_row_5->get_resourcetype( ).
      ENDIF.
    ENDLOOP.
    lo_bucketstate = lo_bucket->get_state( ).
    IF lo_bucketstate IS NOT INITIAL.
      lv_nonemptystring = lo_bucketstate->get_code( ).
      lv_string = lo_bucketstate->get_message( ).
    ENDIF.
    lo_bucketaccesslogconfig = lo_bucket->get_accesslogconfig( ).
    IF lo_bucketaccesslogconfig IS NOT INITIAL.
      lv_boolean = lo_bucketaccesslogconfig->get_enabled( ).
      lv_bucketname = lo_bucketaccesslogconfig->get_destination( ).
      lv_bucketaccesslogprefix = lo_bucketaccesslogconfig->get_prefix( ).
    ENDIF.
    lo_bucketcorsconfig = lo_bucket->get_cors( ).
    IF lo_bucketcorsconfig IS NOT INITIAL.
      LOOP AT lo_bucketcorsconfig->get_rules( ) into lo_row_6.
        lo_row_7 = lo_row_6.
        IF lo_row_7 IS NOT INITIAL.
          lv_bucketcorsruleid = lo_row_7->get_id( ).
          LOOP AT lo_row_7->get_allowedmethods( ) into lo_row_8.
            lo_row_9 = lo_row_8.
            IF lo_row_9 IS NOT INITIAL.
              lv_bucketcorsallowedmethod = lo_row_9->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_row_7->get_allowedorigins( ) into lo_row_10.
            lo_row_11 = lo_row_10.
            IF lo_row_11 IS NOT INITIAL.
              lv_string = lo_row_11->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_row_7->get_allowedheaders( ) into lo_row_12.
            lo_row_13 = lo_row_12.
            IF lo_row_13 IS NOT INITIAL.
              lv_string = lo_row_13->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_row_7->get_exposeheaders( ) into lo_row_14.
            lo_row_15 = lo_row_14.
            IF lo_row_15 IS NOT INITIAL.
              lv_string = lo_row_15->get_value( ).
            ENDIF.
          ENDLOOP.
          lv_integer = lo_row_7->get_maxageseconds( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
  LOOP AT lo_result->get_operations( ) into lo_row_16.
    lo_row_17 = lo_row_16.
    IF lo_row_17 IS NOT INITIAL.
      lv_nonemptystring = lo_row_17->get_id( ).
      lv_resourcename = lo_row_17->get_resourcename( ).
      lv_resourcetype = lo_row_17->get_resourcetype( ).
      lv_isodate = lo_row_17->get_createdat( ).
      lo_resourcelocation = lo_row_17->get_location( ).
      IF lo_resourcelocation IS NOT INITIAL.
        lv_string = lo_resourcelocation->get_availabilityzone( ).
        lv_regionname = lo_resourcelocation->get_regionname( ).
      ENDIF.
      lv_boolean = lo_row_17->get_isterminal( ).
      lv_string = lo_row_17->get_operationdetails( ).
      lv_operationtype = lo_row_17->get_operationtype( ).
      lv_operationstatus = lo_row_17->get_status( ).
      lv_isodate = lo_row_17->get_statuschangedat( ).
      lv_string = lo_row_17->get_errorcode( ).
      lv_string = lo_row_17->get_errordetails( ).
    ENDIF.
  ENDLOOP.
ENDIF.