File: doc.go

package info (click to toggle)
golang-github-aws-aws-sdk-go 1.44.133-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 245,296 kB
  • sloc: makefile: 120
file content (65 lines) | stat: -rw-r--r-- 2,713 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Package endpoints provides the types and functionality for defining regions
// and endpoints, as well as querying those definitions.
//
// The SDK's Regions and Endpoints metadata is code generated into the endpoints
// package, and is accessible via the DefaultResolver function. This function
// returns a endpoint Resolver will search the metadata and build an associated
// endpoint if one is found. The default resolver will search all partitions
// known by the SDK. e.g AWS Standard (aws), AWS China (aws-cn), and
// AWS GovCloud (US) (aws-us-gov).
// .
//
// # Enumerating Regions and Endpoint Metadata
//
// Casting the Resolver returned by DefaultResolver to a EnumPartitions interface
// will allow you to get access to the list of underlying Partitions with the
// Partitions method. This is helpful if you want to limit the SDK's endpoint
// resolving to a single partition, or enumerate regions, services, and endpoints
// in the partition.
//
//	resolver := endpoints.DefaultResolver()
//	partitions := resolver.(endpoints.EnumPartitions).Partitions()
//
//	for _, p := range partitions {
//	    fmt.Println("Regions for", p.ID())
//	    for id, _ := range p.Regions() {
//	        fmt.Println("*", id)
//	    }
//
//	    fmt.Println("Services for", p.ID())
//	    for id, _ := range p.Services() {
//	        fmt.Println("*", id)
//	    }
//	}
//
// # Using Custom Endpoints
//
// The endpoints package also gives you the ability to use your own logic how
// endpoints are resolved. This is a great way to define a custom endpoint
// for select services, without passing that logic down through your code.
//
// If a type implements the Resolver interface it can be used to resolve
// endpoints. To use this with the SDK's Session and Config set the value
// of the type to the EndpointsResolver field of aws.Config when initializing
// the session, or service client.
//
// In addition the ResolverFunc is a wrapper for a func matching the signature
// of Resolver.EndpointFor, converting it to a type that satisfies the
// Resolver interface.
//
//	myCustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) {
//	    if service == endpoints.S3ServiceID {
//	        return endpoints.ResolvedEndpoint{
//	            URL:           "s3.custom.endpoint.com",
//	            SigningRegion: "custom-signing-region",
//	        }, nil
//	    }
//
//	    return endpoints.DefaultResolver().EndpointFor(service, region, optFns...)
//	}
//
//	sess := session.Must(session.NewSession(&aws.Config{
//	    Region:           aws.String("us-west-2"),
//	    EndpointResolver: endpoints.ResolverFunc(myCustomResolver),
//	}))
package endpoints