PutObjectAcl

PutObjectAcl #

Overview #

Uses the acl subresource to set the access control list (ACL) permissions for a new or existing object in an S3 bucket.

AWS API Reference: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectAcl.html

Method #

PUTOBJECTACL

Import Parameters #

The request uses the following import parameters.

  • i_bucket_name (bucket in AWS) (Required)

    Name of the bucket.

  • i_region (Required)

    AWS Region of the Amazon S3 Bucket.

  • i_key (Key) (Required)

    Name of the object key.

  • i_versionid (versionId)

    The versionId of the object that the tag-set will be added to.

  • i_grant (x-amz-acl)

    A list of grants Table.

  • i_owner (x-amz-expected-bucket-owner)

    Container for the bucket owner’s display name and ID Structure.

  • i_x_amz_acl (x-amz-acl)

    The canned ACL to apply to the object.

  • i_x_amz_expected_b_owner (x-amz-expected-bucket-owner)

    The account id of the expected bucket owner.

  • i_x_amz_grant_full_control (x-amz-grant-full-control)

    Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.

  • i_x_amz_grant_read (x-amz-grant-read)

    Allows grantee to list the objects in the bucket.

  • i_x_amz_grant_read_acp (x-amz-grant-read-acp)

    Allows grantee to read the bucket ACL.

  • i_x_amz_grant_write (x-amz-grant-write)

    Allows grantee to create, overwrite, and delete any object in the bucket.

  • i_x_amz_grant_write_acp (x-amz-grant-write-acp)

    Allows grantee to write the ACL for the applicable bucket.

  • i_x_amz_request_payer (x-amz-request-payer)

    Confirms that the requester knows that they will be charged for the request.


Export Parameters #

This method use the following export parameters:

  • e_http_status

    HTTP Status code.

  • e_response_headers

    Returns information about the request in format Name/Value pair values.

  • e_response_content

    Response content in string format.


Example #

DATA: lo_s3               TYPE REF TO /lnkc/cl_sdk_aws_s3,
      lv_http_status      TYPE i,
      lt_response_headers TYPE tihttpnvp,
      lv_response_content TYPE string,
      ls_owner            type /lnkc/aws_s3_s_owner,
      lt_grant            type /lnkc/aws_s3_t_grant.

  TRY.
      CREATE OBJECT lo_s3
        EXPORTING
          i_user_name         = 'user_awsconnector'
          i_access_key        = 'acces_key_value'
          i_secret_access_key = 'secret_acceskey_value'.
  ENDTRY.


  TRY.
        CALL METHOD lo_s3->putobjectacl
          EXPORTING
            i_bucket_name              = 'i_bucket_name'
            i_region                   = 'i_region'
            i_key                      = 'i_key'
            i_versionid                = 'i_versionid' (Optional)
            i_grant                    = lt_grant
            i_owner                    = ls_owner
            i_x_amz_acl                = 'i_x_amz_acl'
            i_x_amz_expected_b_owner   = 'i_x_amz_expected_b_owner' (Optional)
            i_x_amz_grant_full_control = 'i_x_amz_grnt_full_control'
            i_x_amz_grant_read         = 'i_x_amz_grant_read' 
            i_x_amz_grant_read_acp     = 'i_x_amz_grant_read_acp'
            i_x_amz_grant_write        = 'i_x_amz_grant_write'
            i_x_amz_grant_write_acp    = 'i_x_amz_grant_write_acp'
            i_x_amz_request_payer      = 'i_x_amz_request_payer'
          IMPORTING
            e_http_status              = lv_http_status
            e_response_headers         = lt_response_headers
            e_response_content         = lv_response_content.
        .
      CATCH /lnkc/cx_sdk_aws .
        " Error Message
  ENDTRY.