HeadBucket

HeadBucket #

Overview #

To use this operation, you must have permissions to perform the s3:ListBucket action.

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

For more information about permissions: https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html


Method #

HEADBUCKET

Import Parameters #

The request uses the following import parameters.

  • i_bucket_name (bucket in AWS) (Required)

    Name of the bucket.

    Example

    SID: ‘LNK’ + i_bucket_name: ‘test’ => LNK_test.

    • **x-amz-expected-bucket-owner

    The account id of the expected bucket owner

  • i_region (Required)

    AWS Region of the Amazon S3 Bucket.


Export Parameters #

This method use the following export parameters:

  • e_http_status

    HTTP Status code. Returns 200 if no errors found.

  • e_response_headers

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

  • e_response_content

    Response content in string format.


Example #

DATA: lv_bucket             TYPE         /lnkaws/bucket,
      lo_aws_s3_bucket      TYPE REF TO  /lnkaws/cl_aws_s3_bucket,
      lo_cx_aws_s3          TYPE REF TO  /lnkaws/cx_aws_s3,
      lv_http_status        TYPE         i,
      lt_response_headers   TYPE         tihttpnvp,
      lv_response_content   type         string.

 ls_bucket-bucket    = 'newbucket1'.
 ls_bucket-user_name = 'userawsconnector'.
 ls_bucket-region    = 'eu-west-1'.

TRY.
    CALL METHOD lo_aws_s3_bucket->headbucket
      EXPORTING
        i_bucket_name            = lv_bucket
        i_region                 = lv_region
        i_x_amz_expected_b_owner = lv_expbow
      IMPORTING
        e_http_status            = lv_http_status
        e_response_headers       = lt_response_headers
        e_response_content       = lv_response_content.
    if lv_http_status = /lnkaws/cl_http=>c_status_200_ok.
    endif.
    CATCH /lnkaws/cx_aws_s3 INTO lo_cx_aws_s3.
ENDTRY.