-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release v1.35.0 (2020-09-30) === ### Service Client Updates * `service/application-autoscaling`: Updates service API and documentation * `service/datasync`: Updates service API and documentation * `service/directconnect`: Updates service documentation * Documentation updates for AWS Direct Connect. * `service/elasticmapreduce`: Updates service API and documentation * Amazon EMR customers can now use EC2 placement group to influence the placement of master nodes in a high-availability (HA) cluster across distinct underlying hardware to improve cluster availability. * `service/imagebuilder`: Updates service API and documentation * `service/iot`: Updates service API and documentation * AWS IoT Rules Engine adds Timestream action. The Timestream rule action lets you stream time-series data from IoT sensors and applications to Amazon Timestream databases for time series analysis. * `service/mediaconnect`: Updates service API, documentation, and paginators * `service/pinpoint`: Updates service API and documentation * Amazon Pinpoint - Features - Customers can start a journey based on an event being triggered by an endpoint or user. * `service/s3`: Updates service API, documentation, and examples * Amazon S3 on Outposts expands object storage to on-premises AWS Outposts environments, enabling you to store and retrieve objects using S3 APIs and features. * `service/s3outposts`: Adds new service * `service/securityhub`: Updates service API and documentation ### SDK Features * `service/s3`: Adds support for outposts access point ARNs. * `service/s3control`: Adds support for S3 on outposts access point and S3 on outposts bucket ARNs.
- Loading branch information
1 parent
235bdca
commit 3ddfe5c
Showing
80 changed files
with
26,168 additions
and
6,549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package arn | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/aws/aws-sdk-go/aws/arn" | ||
) | ||
|
||
// OutpostARN interface that should be satisfied by outpost ARNs | ||
type OutpostARN interface { | ||
Resource | ||
GetOutpostID() string | ||
} | ||
|
||
// ParseOutpostARNResource will parse a provided ARNs resource using the appropriate ARN format | ||
// and return a specific OutpostARN type | ||
// | ||
// Currently supported outpost ARN formats: | ||
// * Outpost AccessPoint ARN format: | ||
// - ARN format: arn:{partition}:s3-outposts:{region}:{accountId}:outpost/{outpostId}/accesspoint/{accesspointName} | ||
// - example: arn:aws:s3-outposts:us-west-2:012345678901:outpost/op-1234567890123456/accesspoint/myaccesspoint | ||
// | ||
// * Outpost Bucket ARN format: | ||
// - ARN format: arn:{partition}:s3-outposts:{region}:{accountId}:outpost/{outpostId}/bucket/{bucketName} | ||
// - example: arn:aws:s3-outposts:us-west-2:012345678901:outpost/op-1234567890123456/bucket/mybucket | ||
// | ||
// Other outpost ARN formats may be supported and added in the future. | ||
// | ||
func ParseOutpostARNResource(a arn.ARN, resParts []string) (OutpostARN, error) { | ||
if len(a.Region) == 0 { | ||
return nil, InvalidARNError{ARN: a, Reason: "region not set"} | ||
} | ||
|
||
if len(a.AccountID) == 0 { | ||
return nil, InvalidARNError{ARN: a, Reason: "account-id not set"} | ||
} | ||
|
||
// verify if outpost id is present and valid | ||
if len(resParts) == 0 || len(strings.TrimSpace(resParts[0])) == 0 { | ||
return nil, InvalidARNError{ARN: a, Reason: "outpost resource-id not set"} | ||
} | ||
|
||
// verify possible resource type exists | ||
if len(resParts) < 3 { | ||
return nil, InvalidARNError{ | ||
ARN: a, Reason: "incomplete outpost resource type. Expected bucket or access-point resource to be present", | ||
} | ||
} | ||
|
||
// Since we know this is a OutpostARN fetch outpostID | ||
outpostID := strings.TrimSpace(resParts[0]) | ||
|
||
switch resParts[1] { | ||
case "accesspoint": | ||
accesspointARN, err := ParseAccessPointResource(a, resParts[2:]) | ||
if err != nil { | ||
return OutpostAccessPointARN{}, err | ||
} | ||
return OutpostAccessPointARN{ | ||
AccessPointARN: accesspointARN, | ||
OutpostID: outpostID, | ||
}, nil | ||
|
||
case "bucket": | ||
bucketName, err := parseBucketResource(a, resParts[2:]) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return OutpostBucketARN{ | ||
ARN: a, | ||
BucketName: bucketName, | ||
OutpostID: outpostID, | ||
}, nil | ||
|
||
default: | ||
return nil, InvalidARNError{ARN: a, Reason: "unknown resource set for outpost ARN"} | ||
} | ||
} | ||
|
||
// OutpostAccessPointARN represents outpost access point ARN. | ||
type OutpostAccessPointARN struct { | ||
AccessPointARN | ||
OutpostID string | ||
} | ||
|
||
// GetOutpostID returns the outpost id of outpost access point arn | ||
func (o OutpostAccessPointARN) GetOutpostID() string { | ||
return o.OutpostID | ||
} | ||
|
||
// OutpostBucketARN represents the outpost bucket ARN. | ||
type OutpostBucketARN struct { | ||
arn.ARN | ||
BucketName string | ||
OutpostID string | ||
} | ||
|
||
// GetOutpostID returns the outpost id of outpost bucket arn | ||
func (o OutpostBucketARN) GetOutpostID() string { | ||
return o.OutpostID | ||
} | ||
|
||
// GetARN retrives the base ARN from outpost bucket ARN resource | ||
func (o OutpostBucketARN) GetARN() arn.ARN { | ||
return o.ARN | ||
} | ||
|
||
// parseBucketResource attempts to parse the ARN's bucket resource and retrieve the | ||
// bucket resource id. | ||
// | ||
// parseBucketResource only parses the bucket resource id. | ||
// | ||
func parseBucketResource(a arn.ARN, resParts []string) (bucketName string, err error) { | ||
if len(resParts) == 0 { | ||
return bucketName, InvalidARNError{ARN: a, Reason: "bucket resource-id not set"} | ||
} | ||
if len(resParts) > 1 { | ||
return bucketName, InvalidARNError{ARN: a, Reason: "sub resource not supported"} | ||
} | ||
|
||
bucketName = strings.TrimSpace(resParts[0]) | ||
if len(bucketName) == 0 { | ||
return bucketName, InvalidARNError{ARN: a, Reason: "bucket resource-id not set"} | ||
} | ||
return bucketName, err | ||
} |
Oops, something went wrong.