aws-beam / aws-codegen

Code generator for AWS clients in Erlang and Elixir.
Other
53 stars 49 forks source link

Handle binary body argument #30

Closed jfacorro closed 3 years ago

jfacorro commented 4 years ago

Some endpoints don't encode the body in the default Content-Type but allow to provide an arbitrary request body. The specification signals this cases by having Body as the payload.

For example in the S3 service the PutObject operation should be able to accept a binary body:

"PutObjectRequest":{
      "type":"structure",
      "required":[
        "Bucket",
        "Key"
      ],
      "members":{
        "ACL":{
          "shape":"ObjectCannedACL",
          "location":"header",
          "locationName":"x-amz-acl"
        },
        "Body":{
          "shape":"Body",
          "streaming":true
        },
        "Bucket":{
          "shape":"BucketName",
          "location":"uri",
          "locationName":"Bucket"
        },
        "CacheControl":{
          "shape":"CacheControl",
          "location":"header",
          "locationName":"Cache-Control"
        },
        "ContentDisposition":{
          "shape":"ContentDisposition",
          "location":"header",
          "locationName":"Content-Disposition"
        },
        "ContentEncoding":{
          "shape":"ContentEncoding",
          "location":"header",
          "locationName":"Content-Encoding"
        },
        "ContentLanguage":{
          "shape":"ContentLanguage",
          "location":"header",
          "locationName":"Content-Language"
        },
        "ContentLength":{
          "shape":"ContentLength",
          "location":"header",
          "locationName":"Content-Length"
        },
        "ContentMD5":{
          "shape":"ContentMD5",
          "location":"header",
          "locationName":"Content-MD5"
        },
        "ContentType":{
          "shape":"ContentType",
          "location":"header",
          "locationName":"Content-Type"
        },
        "Expires":{
          "shape":"Expires",
          "location":"header",
          "locationName":"Expires"
        },
        "GrantFullControl":{
          "shape":"GrantFullControl",
          "location":"header",
          "locationName":"x-amz-grant-full-control"
        },
        "GrantRead":{
          "shape":"GrantRead",
          "location":"header",
          "locationName":"x-amz-grant-read"
        },
        "GrantReadACP":{
          "shape":"GrantReadACP",
          "location":"header",
          "locationName":"x-amz-grant-read-acp"
        },
        "GrantWriteACP":{
          "shape":"GrantWriteACP",
          "location":"header",
          "locationName":"x-amz-grant-write-acp"
        },
        "Key":{
          "shape":"ObjectKey",
          "location":"uri",
          "locationName":"Key"
        },
        "Metadata":{
          "shape":"Metadata",
          "location":"headers",
          "locationName":"x-amz-meta-"
        },
        "ServerSideEncryption":{
          "shape":"ServerSideEncryption",
          "location":"header",
          "locationName":"x-amz-server-side-encryption"
        },
        "StorageClass":{
          "shape":"StorageClass",
          "location":"header",
          "locationName":"x-amz-storage-class"
        },
        "WebsiteRedirectLocation":{
          "shape":"WebsiteRedirectLocation",
          "location":"header",
          "locationName":"x-amz-website-redirect-location"
        },
        "SSECustomerAlgorithm":{
          "shape":"SSECustomerAlgorithm",
          "location":"header",
          "locationName":"x-amz-server-side-encryption-customer-algorithm"
        },
        "SSECustomerKey":{
          "shape":"SSECustomerKey",
          "location":"header",
          "locationName":"x-amz-server-side-encryption-customer-key"
        },
        "SSECustomerKeyMD5":{
          "shape":"SSECustomerKeyMD5",
          "location":"header",
          "locationName":"x-amz-server-side-encryption-customer-key-MD5"
        },
        "SSEKMSKeyId":{
          "shape":"SSEKMSKeyId",
          "location":"header",
          "locationName":"x-amz-server-side-encryption-aws-kms-key-id"
        },
        "SSEKMSEncryptionContext":{
          "shape":"SSEKMSEncryptionContext",
          "location":"header",
          "locationName":"x-amz-server-side-encryption-context"
        },
        "RequestPayer":{
          "shape":"RequestPayer",
          "location":"header",
          "locationName":"x-amz-request-payer"
        },
        "Tagging":{
          "shape":"TaggingHeader",
          "location":"header",
          "locationName":"x-amz-tagging"
        },
        "ObjectLockMode":{
          "shape":"ObjectLockMode",
          "location":"header",
          "locationName":"x-amz-object-lock-mode"
        },
        "ObjectLockRetainUntilDate":{
          "shape":"ObjectLockRetainUntilDate",
          "location":"header",
          "locationName":"x-amz-object-lock-retain-until-date"
        },
        "ObjectLockLegalHoldStatus":{
          "shape":"ObjectLockLegalHoldStatus",
          "location":"header",
          "locationName":"x-amz-object-lock-legal-hold"
        }
      },
      "payload":"Body"
    }
philss commented 3 years ago

Closed by #62.