Skip to content

Commit

Permalink
Update S3 and S3 Control Models (#3826)
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Mar 18, 2021
1 parent 888dfa8 commit 308635b
Show file tree
Hide file tree
Showing 27 changed files with 5,473 additions and 1,059 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Release v1.37.32 (2021-03-16)
Release v1.37.31 (2021-03-15)
===

### Announcement
* The HEAD tracking branch of the repository has been renamed from `master` to `main`.
* Users using GOPATH to manage application dependencies need to remove the SDK from GOPATH and re-retrieve the SDK using `go get github.com/aws/aws-sdk-go`.

### Service Client Updates
* `service/codedeploy`: Updates service API and documentation
* AWS CodeDeploy can now detect instances running an outdated revision of your application and automatically update them with the latest revision.
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
### SDK Features
* `service/s3`: S3 Object Lambda is a new S3 feature that enables users to apply their own custom code to process the output of a standard S3 GET request by automatically invoking a Lambda function with a GET request
* `service/s3control`: S3 Object Lambda is a new S3 feature that enables users to apply their own custom code to process the output of a standard S3 GET request by automatically invoking a Lambda function with a GET request.

### SDK Enhancements

Expand Down
5 changes: 4 additions & 1 deletion aws/signer/v4/v4.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,12 @@ func (ctx *signingCtx) buildBodyDigest() error {
if hash == "" {
includeSHA256Header := ctx.unsignedPayload ||
ctx.ServiceName == "s3" ||
ctx.ServiceName == "s3-object-lambda" ||
ctx.ServiceName == "glacier"

s3Presign := ctx.isPresign && ctx.ServiceName == "s3"
s3Presign := ctx.isPresign &&
(ctx.ServiceName == "s3" ||
ctx.ServiceName == "s3-object-lambda")

if ctx.unsignedPayload || s3Presign {
hash = "UNSIGNED-PAYLOAD"
Expand Down
18 changes: 17 additions & 1 deletion internal/s3shared/arn/arn.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ import (
"github.com/aws/aws-sdk-go/aws/arn"
)

var supportedServiceARN = []string{
"s3",
"s3-outposts",
"s3-object-lambda",
}

func isSupportedServiceARN(service string) bool {
for _, name := range supportedServiceARN {
if name == service {
return true
}
}
return false
}

// Resource provides the interfaces abstracting ARNs of specific resource
// types.
type Resource interface {
Expand All @@ -29,9 +44,10 @@ func ParseResource(s string, resParser ResourceParser) (resARN Resource, err err
return nil, InvalidARNError{ARN: a, Reason: "partition not set"}
}

if a.Service != "s3" && a.Service != "s3-outposts" {
if !isSupportedServiceARN(a.Service) {
return nil, InvalidARNError{ARN: a, Reason: "service is not supported"}
}

if len(a.Resource) == 0 {
return nil, InvalidARNError{ARN: a, Reason: "resource not set"}
}
Expand Down
15 changes: 15 additions & 0 deletions internal/s3shared/arn/s3_object_lambda_arn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package arn

// S3ObjectLambdaARN represents an ARN for the s3-object-lambda service
type S3ObjectLambdaARN interface {
Resource

isS3ObjectLambdasARN()
}

// S3ObjectLambdaAccessPointARN is an S3ObjectLambdaARN for the Access Point resource type
type S3ObjectLambdaAccessPointARN struct {
AccessPointARN
}

func (s S3ObjectLambdaAccessPointARN) isS3ObjectLambdasARN() {}
207 changes: 207 additions & 0 deletions models/apis/s3/2006-03-01/api-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,18 @@
"input":{"shape":"UploadPartCopyRequest"},
"output":{"shape":"UploadPartCopyOutput"},
"documentationUrl":"http:https://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadUploadPartCopy.html"
},
"WriteGetObjectResponse":{
"name":"WriteGetObjectResponse",
"http":{
"method":"POST",
"requestUri":"/WriteGetObjectResponse"
},
"input":{"shape":"WriteGetObjectResponseRequest"},
"authtype":"v4-unsigned-body",
"endpoint":{
"hostPrefix":"{RequestRoute}."
}
}
},
"shapes":{
Expand Down Expand Up @@ -2580,13 +2592,15 @@
"Message":{"shape":"Message"}
}
},
"ErrorCode":{"type":"string"},
"ErrorDocument":{
"type":"structure",
"required":["Key"],
"members":{
"Key":{"shape":"ObjectKey"}
}
},
"ErrorMessage":{"type":"string"},
"Errors":{
"type":"list",
"member":{"shape":"Error"},
Expand Down Expand Up @@ -3584,6 +3598,7 @@
}
}
},
"GetObjectResponseStatusCode":{"type":"integer"},
"GetObjectRetentionOutput":{
"type":"structure",
"members":{
Expand Down Expand Up @@ -6740,6 +6755,8 @@
"Enabled":{"shape":"EnableRequestProgress"}
}
},
"RequestRoute":{"type":"string"},
"RequestToken":{"type":"string"},
"ResponseCacheControl":{"type":"string"},
"ResponseContentDisposition":{"type":"string"},
"ResponseContentEncoding":{"type":"string"},
Expand Down Expand Up @@ -7555,6 +7572,196 @@
}
},
"WebsiteRedirectLocation":{"type":"string"},
"WriteGetObjectResponseRequest":{
"type":"structure",
"required":[
"RequestRoute",
"RequestToken"
],
"members":{
"RequestRoute":{
"shape":"RequestRoute",
"hostLabel":true,
"location":"header",
"locationName":"x-amz-request-route"
},
"RequestToken":{
"shape":"RequestToken",
"location":"header",
"locationName":"x-amz-request-token"
},
"Body":{
"shape":"Body",
"streaming":true
},
"StatusCode":{
"shape":"GetObjectResponseStatusCode",
"location":"header",
"locationName":"x-amz-fwd-status"
},
"ErrorCode":{
"shape":"ErrorCode",
"location":"header",
"locationName":"x-amz-fwd-error-code"
},
"ErrorMessage":{
"shape":"ErrorMessage",
"location":"header",
"locationName":"x-amz-fwd-error-message"
},
"AcceptRanges":{
"shape":"AcceptRanges",
"location":"header",
"locationName":"x-amz-fwd-header-accept-ranges"
},
"CacheControl":{
"shape":"CacheControl",
"location":"header",
"locationName":"x-amz-fwd-header-Cache-Control"
},
"ContentDisposition":{
"shape":"ContentDisposition",
"location":"header",
"locationName":"x-amz-fwd-header-Content-Disposition"
},
"ContentEncoding":{
"shape":"ContentEncoding",
"location":"header",
"locationName":"x-amz-fwd-header-Content-Encoding"
},
"ContentLanguage":{
"shape":"ContentLanguage",
"location":"header",
"locationName":"x-amz-fwd-header-Content-Language"
},
"ContentLength":{
"shape":"ContentLength",
"location":"header",
"locationName":"Content-Length"
},
"ContentRange":{
"shape":"ContentRange",
"location":"header",
"locationName":"x-amz-fwd-header-Content-Range"
},
"ContentType":{
"shape":"ContentType",
"location":"header",
"locationName":"x-amz-fwd-header-Content-Type"
},
"DeleteMarker":{
"shape":"DeleteMarker",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-delete-marker"
},
"ETag":{
"shape":"ETag",
"location":"header",
"locationName":"x-amz-fwd-header-ETag"
},
"Expires":{
"shape":"Expires",
"location":"header",
"locationName":"x-amz-fwd-header-Expires"
},
"Expiration":{
"shape":"Expiration",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-expiration"
},
"LastModified":{
"shape":"LastModified",
"location":"header",
"locationName":"x-amz-fwd-header-Last-Modified"
},
"MissingMeta":{
"shape":"MissingMeta",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-missing-meta"
},
"Metadata":{
"shape":"Metadata",
"location":"headers",
"locationName":"x-amz-meta-"
},
"ObjectLockMode":{
"shape":"ObjectLockMode",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-object-lock-mode"
},
"ObjectLockLegalHoldStatus":{
"shape":"ObjectLockLegalHoldStatus",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-object-lock-legal-hold"
},
"ObjectLockRetainUntilDate":{
"shape":"ObjectLockRetainUntilDate",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-object-lock-retain-until-date"
},
"PartsCount":{
"shape":"PartsCount",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-mp-parts-count"
},
"ReplicationStatus":{
"shape":"ReplicationStatus",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-replication-status"
},
"RequestCharged":{
"shape":"RequestCharged",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-request-charged"
},
"Restore":{
"shape":"Restore",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-restore"
},
"ServerSideEncryption":{
"shape":"ServerSideEncryption",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-server-side-encryption"
},
"SSECustomerAlgorithm":{
"shape":"SSECustomerAlgorithm",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-server-side-encryption-customer-algorithm"
},
"SSEKMSKeyId":{
"shape":"SSEKMSKeyId",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-server-side-encryption-aws-kms-key-id"
},
"SSECustomerKeyMD5":{
"shape":"SSECustomerKeyMD5",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-server-side-encryption-customer-key-MD5"
},
"StorageClass":{
"shape":"StorageClass",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-storage-class"
},
"TagCount":{
"shape":"TagCount",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-tagging-count"
},
"VersionId":{
"shape":"ObjectVersionId",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-version-id"
},
"BucketKeyEnabled":{
"shape":"BucketKeyEnabled",
"location":"header",
"locationName":"x-amz-fwd-header-x-amz-server-side-encryption-bucket-key-enabled"
}
},
"payload":"Body"
},
"Years":{"type":"integer"}
}
}
Loading

0 comments on commit 308635b

Please sign in to comment.