PutObject

PutObjectAcl #

Overview #

Adds an object to a bucket. You must have WRITE permissions on a bucket to add an object to it.

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

Method #

PUTOBJECT

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_cache_control (Cache-Contro in AWS)

    Can be used to specify caching behavior along the request/reply chain. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9

  • i_content_disposition (Content-Disposition in AWS)

    Specifies presentational information for the object.

  • i_content_encoding (Content-Encoding in AWS)

    Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.

  • i_content_language (Content-Language in AWS)

    The language the content is in.

  • i_content_length ()

    Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically.

  • i_content_type ()

    A standard MIME type describing the format of the contents.

  • i_content_expires (Expires in AWS)

    The date and time at which the object is no longer cacheable.

  • i_xcontent () (Required)

    File Content in xstring format.

  • i_key (Key) (Required)

    Name of the object key.

  • i_x_amz_acl (x-amz-acl in AWS)

    The canned ACL to apply to the object.

  • i_x_amz_expected_bucket_owner (x-amz-expected-bucket-owner in AWS)

    The account id of the expected bucket owner.

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

    Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.

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

    Allows grantee to read the object ACL.

  • i_x_amz_grant_read (x-amz-grant-read in AWS)

    Allows grantee to read the object data and its metadata.

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

    Allows grantee to write the ACL for the applicable object.

  • i_x_amz_object_lock_legal_hold (x-amz-object-lock-legal-hold in AWS)

    Specifies whether a legal hold will be applied to this object.

  • i_x_amz_object_lock_mode (x-amz-object-lock-mode in AWS)

    The Object Lock mode that you want to apply to this object.

  • i_x_amz_object_lock_retain_unt (x-amz-object-lock-retain-until-date in AWS)

    The date and time when you want this object’s Object Lock to expire.

  • i_x_amz_reques_payer (x-amz-request-payer in AWS)

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

  • i_x_amz_server_side_encryption (x-amz-server-side-encryption in AWS)

    The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256, aws:kms).

  • i_x_amz_serversidee_encryp_aws (x-amz-server-side-encryption-aws-kms-key-id in AWS)

    If x-amz-server-side-encryption is present and has the value of aws:kms, this header specifies the ID of the AWS Key Management Service (AWS KMS) symmetrical customer managed customer master key (CMK) that was used for the object.

  • i_x_amz_serv_side_encryp_conte (x-amz-server-side-encryption-context in AWS)

    Specifies the AWS KMS Encryption Context to use for object encryption.

  • i_x_amz_servside_encry_custlag (x-amz-server-side-encryption-customer-algorithm in AWS)

    Specifies the algorithm to use to when encrypting the object (for example, AES256).

  • i_x_amz_servside_encryp_custke (x-amz-server-side-encryption-customer-key in AWS)

    Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data.

  • i_x_amz_servside_encrycustmd5 (x-amz-server-side-encryption-customer-key-MD5 in AWS)

    Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.

  • i_x_amz_storage_class (x-amz-storage-class in AWS)

    By default, Amazon S3 uses the STANDARD Storage Class to store newly created objects.

  • i_x_amz_tagging (x-amz-tagging in AWS)

    The tag-set for the object. The tag-set must be encoded as URL Query parameters.

  • i_x_amz_website_redirect_locat (x-amz-website-redirect-location in AWS)

    If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL.


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.

  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->putobject
          EXPORTING
            i_bucket_name                   = 'i_bucket_name'
            i_region                        = 'i_region'
            i_xcontent                      = 'i_xcontent'
*           i_cache_control                 =
*           i_content_disposition           =
*           i_content_encoding              =
*           i_content_language              =
*           i_content_length                = 
            i_content_type                  = 'application/octet-stream'
*           i_content_expires               =
            i_key                           = 'i_key'
*           i_x_amz_acl                     = 
*           i_x_amz_expected_bucket_owner  =
*           i_x_amz_grant_full_control     = 
*           i_x_amz_grant_read_acp         =
*           i_x_amz_grant_read =
*           i_x_amz_grant_write_acp        =
*           i_x_amz_object_lock_legal_hold = 
*           i_x_amz_object_lock_mode       = 
*           i_x_amz_object_lock_retain_unt =
*           i_x_amz_reques_payer           = 
*           i_x_amz_server_side_encryption = 
*           i_x_amz_serversidee_encryp_aws =
*           i_x_amz_serv_side_encryp_conte =
*           i_x_amz_servside_encry_custalg =
*           i_x_amz_servside_encryp_custke =
*           i_x_amz_servside_encrycustmd5  =
*           i_x_amz_storage_class          = 
*           i_x_amz_tagging                =
*           i_x_amz_website_redirect_locat =
          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.