Comments (6)
This API is very weird: https://godoc.org/github.com/aws/aws-sdk-go-v2/aws/endpoints#Partition.Regions
A map[string]Region
for a return?! A list is far more idiomatic, no?
Also the second bool parameter in the return of https://godoc.org/github.com/aws/aws-sdk-go-v2/aws/endpoints#Partitions.ForPartition is really not idiomatic.
from aws-sdk-go-v2.
@kaihendry - Second bool parameter being returned can be found in the standard library. See here. I believe this best indicates whether or not something has been found.
In addition, what data structure that is returned such as map
versus []
doesn't really fit the definition of idiomatic. The map
was chosen to let users easily grab the region they wanted without needing to iterate. We could type alias it like shown here in the standard library. How do you feel about it being type aliased instead of a map
?
from aws-sdk-go-v2.
Thanks for the link. TIL something new. Though I understand an ENV VAR="" being set as empty. However why would a partition be and why would you need to account for that?
I don't quite understand what you mean by aliased. You referenced map[string][]string
?
from aws-sdk-go-v2.
@kaihendry - I referenced the http.Header
header object that type aliases it to a map[string][]string
.
from aws-sdk-go-v2.
@kaihendry Thanks for the feedback. The endpoints#Partition.Regions returns a map to make it easy to determine if a partition includes a region. A partition is an idea like AWS global, AWS China, and AWS GovCloud. Each of these partitions have their own unique set of regions.
The reason Region
returns a map instead a slice isn't very strong. But it was consistent with the method for services, which are also a map. In addition this is partly because the data is stored internally as maps. Converting the internal map to a list would add overhead for each method.
endpoints#Partitions could be updated to include a ForService
to return a sub slice of partitions which include support for a service.
For your original linked code example. I'd suggest the following pattern to simplify iterating over the regions, https://play.golang.org/p/6M6Cd9dusm3
from aws-sdk-go-v2.
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
from aws-sdk-go-v2.
Related Issues (20)
- STS: AssumeRole, https response error StatusCode: 403 HOT 13
- PartiQl for the go sdk HOT 3
- EndpointResolverV2 broken with Ceph HOT 4
- unwanted context timeout added to imds requests HOT 2
- service/s3: S3 does not appear to support path-style addressing HOT 1
- attributevalue.UnmarshalListOfMaps doesn't support json key diff from struct field name HOT 4
- Adding support of versionId in s3:SelectObjectContent HOT 3
- EndpointResolverV2 doesn't error if an endpoint is not found HOT 1
- Adding support of versionId in s3:SelectObjectContent(short issue description) HOT 5
- PlatformValuesWindows value is incorrect HOT 2
- EventBridge/CloudWatch Events: Add support for time zones HOT 3
- connection header needs to be excluded in sigv4a/sigv4
- Use `encoding.TextMarshaler` and `encoding.TextUnmarshaler` in DynamoDB `attributevalue` marshalers/unmarshalers, if available HOT 1
- Improve formatting of package doc for secretsmanager HOT 3
- iam.NewListRolesPaginator.NextPage suddenly doesn't return "Tags" HOT 5
- Missing json => dynamodbav v2 migration HOT 1
- DynamoDB:UpdateItem ReturnValuesOnConditionCheckFailure flag does not work HOT 5
- Get Filtered Repositories from ECR(short issue description) HOT 2
- S3: False Request and 'Object Not Found' Error When Bucket Name Matches Object Key Prefix and usePathStyle is False HOT 2
- S3: `DeleteObjects` Creates File Versions and Delete Markers Regardless of File Existence with `ObjectLockEnabledForBucket` Set to True HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-go-v2.