Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update S3 and S3 Control Models #3826

Merged
merged 6 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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://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