A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.aws.amazon.com/sdk-for-go/api/aws/endpoints below:

endpoints - Amazon Web Services

Overview ▹

Overview ▾

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),
}))

Deprecated: aws-sdk-go is deprecated. Use aws-sdk-go-v2. See https://aws.amazon.com/blogs/developer/announcing-end-of-support-for-aws-sdk-for-go-v1-on-july-31-2025/.

Index ▹

Index ▾
Constants
func AddScheme(endpoint string, disableSSL bool) string
func DisableSSLOption(o *Options)
func RegionsForService(ps []Partition, partitionID, serviceID string) (map[string]Region, bool)
func ResolveUnknownServiceOption(o *Options)
func STSRegionalEndpointOption(o *Options)
func StrictMatchingOption(o *Options)
func UseDualStackEndpointOption(o *Options)
func UseDualStackOption(o *Options)
func UseFIPSEndpointOption(o *Options)
type DecodeModelOptions
    func (d *DecodeModelOptions) Set(optFns ...func(*DecodeModelOptions))
type DualStackEndpointState
type EC2IMDSEndpointModeState
    func (e *EC2IMDSEndpointModeState) SetFromString(v string) error
type Endpoint
    func (e Endpoint) ID() string
    func (e Endpoint) ResolveEndpoint(opts ...func(*Options)) (ResolvedEndpoint, error)
    func (e Endpoint) ServiceID() string
type EndpointNotFoundError
type EnumPartitions
type FIPSEndpointState
type Logger
type Options
    func (o *Options) Set(optFns ...func(*Options))
type Partition
    func AwsCnPartition() Partition
    func AwsIsoBPartition() Partition
    func AwsIsoEPartition() Partition
    func AwsIsoFPartition() Partition
    func AwsIsoPartition() Partition
    func AwsPartition() Partition
    func AwsUsGovPartition() Partition
    func DefaultPartitions() []Partition
    func PartitionForRegion(ps []Partition, regionID string) (Partition, bool)
    func (p Partition) DNSSuffix() string
    func (p Partition) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error)
    func (p Partition) ID() string
    func (p Partition) Regions() map[string]Region
    func (p Partition) Services() map[string]Service
type Region
    func (r Region) Description() string
    func (r Region) ID() string
    func (r Region) ResolveEndpoint(service string, opts ...func(*Options)) (ResolvedEndpoint, error)
    func (r Region) Services() map[string]Service
type ResolvedEndpoint
type Resolver
    func DecodeModel(r io.Reader, optFns ...func(*DecodeModelOptions)) (Resolver, error)
    func DefaultResolver() Resolver
type ResolverFunc
    func (fn ResolverFunc) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error)
type S3UsEast1RegionalEndpoint
    func GetS3UsEast1RegionalEndpoint(s string) (S3UsEast1RegionalEndpoint, error)
    func (e S3UsEast1RegionalEndpoint) String() string
type STSRegionalEndpoint
    func GetSTSRegionalEndpoint(s string) (STSRegionalEndpoint, error)
    func (e STSRegionalEndpoint) String() string
type Service
    func (s Service) Endpoints() map[string]Endpoint
    func (s Service) ID() string
    func (s Service) Regions() map[string]Region
    func (s Service) ResolveEndpoint(region string, opts ...func(*Options)) (ResolvedEndpoint, error)
type UnknownEndpointError
    func NewUnknownEndpointError(p, s, r string, known []string) UnknownEndpointError
    func (e UnknownEndpointError) Error() string
    func (e UnknownEndpointError) String() string
type UnknownServiceError
    func NewUnknownServiceError(p, s string, known []string) UnknownServiceError
    func (e UnknownServiceError) Error() string
    func (e UnknownServiceError) String() string
Package files

decode.go defaults.go dep_service_ids.go doc.go endpoints.go legacy_regions.go v3model.go

Internal call graph ▹

Internal call graph ▾

In the call graph viewer below, each node is a function belonging to this package and its children are the functions it calls—perhaps dynamically.

The root nodes are the entry points of the package: functions that may be called from outside the package. There may be non-exported or anonymous functions among them if they are called dynamically from another package.

Click a node to visit that function's source code. From there you can visit its callers by clicking its declaring func token.

Functions may be omitted if they were determined to be unreachable in the particular programs or tests that were analyzed.

Constants ¶
const (
    AwsPartitionID      = "aws"        
    AwsCnPartitionID    = "aws-cn"     
    AwsUsGovPartitionID = "aws-us-gov" 
    AwsIsoPartitionID   = "aws-iso"    
    AwsIsoBPartitionID  = "aws-iso-b"  
    AwsIsoEPartitionID  = "aws-iso-e"  
    AwsIsoFPartitionID  = "aws-iso-f"  
)

Partition identifiers

const (
    AfSouth1RegionID     = "af-south-1"     
    ApEast1RegionID      = "ap-east-1"      
    ApNortheast1RegionID = "ap-northeast-1" 
    ApNortheast2RegionID = "ap-northeast-2" 
    ApNortheast3RegionID = "ap-northeast-3" 
    ApSouth1RegionID     = "ap-south-1"     
    ApSouth2RegionID     = "ap-south-2"     
    ApSoutheast1RegionID = "ap-southeast-1" 
    ApSoutheast2RegionID = "ap-southeast-2" 
    ApSoutheast3RegionID = "ap-southeast-3" 
    ApSoutheast4RegionID = "ap-southeast-4" 
    CaCentral1RegionID   = "ca-central-1"   
    CaWest1RegionID      = "ca-west-1"      
    EuCentral1RegionID   = "eu-central-1"   
    EuCentral2RegionID   = "eu-central-2"   
    EuNorth1RegionID     = "eu-north-1"     
    EuSouth1RegionID     = "eu-south-1"     
    EuSouth2RegionID     = "eu-south-2"     
    EuWest1RegionID      = "eu-west-1"      
    EuWest2RegionID      = "eu-west-2"      
    EuWest3RegionID      = "eu-west-3"      
    IlCentral1RegionID   = "il-central-1"   
    MeCentral1RegionID   = "me-central-1"   
    MeSouth1RegionID     = "me-south-1"     
    SaEast1RegionID      = "sa-east-1"      
    UsEast1RegionID      = "us-east-1"      
    UsEast2RegionID      = "us-east-2"      
    UsWest1RegionID      = "us-west-1"      
    UsWest2RegionID      = "us-west-2"      
)

AWS Standard partition's regions.

const (
    CnNorth1RegionID     = "cn-north-1"     
    CnNorthwest1RegionID = "cn-northwest-1" 
)

AWS China partition's regions.

const (
    UsGovEast1RegionID = "us-gov-east-1" 
    UsGovWest1RegionID = "us-gov-west-1" 
)

AWS GovCloud (US) partition's regions.

const (
    UsIsoEast1RegionID = "us-iso-east-1" 
    UsIsoWest1RegionID = "us-iso-west-1" 
)

AWS ISO (US) partition's regions.

const (
    A4bServiceID                          = "a4b"                          
    AcmServiceID                          = "acm"                          
    AcmPcaServiceID                       = "acm-pca"                      
    ApiMediatailorServiceID               = "api.mediatailor"              
    ApiPricingServiceID                   = "api.pricing"                  
    ApiSagemakerServiceID                 = "api.sagemaker"                
    ApigatewayServiceID                   = "apigateway"                   
    ApplicationAutoscalingServiceID       = "application-autoscaling"      
    Appstream2ServiceID                   = "appstream2"                   
    AppsyncServiceID                      = "appsync"                      
    AthenaServiceID                       = "athena"                       
    AutoscalingServiceID                  = "autoscaling"                  
    AutoscalingPlansServiceID             = "autoscaling-plans"            
    BatchServiceID                        = "batch"                        
    BudgetsServiceID                      = "budgets"                      
    CeServiceID                           = "ce"                           
    ChimeServiceID                        = "chime"                        
    Cloud9ServiceID                       = "cloud9"                       
    ClouddirectoryServiceID               = "clouddirectory"               
    CloudformationServiceID               = "cloudformation"               
    CloudfrontServiceID                   = "cloudfront"                   
    CloudhsmServiceID                     = "cloudhsm"                     
    Cloudhsmv2ServiceID                   = "cloudhsmv2"                   
    CloudsearchServiceID                  = "cloudsearch"                  
    CloudtrailServiceID                   = "cloudtrail"                   
    CodebuildServiceID                    = "codebuild"                    
    CodecommitServiceID                   = "codecommit"                   
    CodedeployServiceID                   = "codedeploy"                   
    CodepipelineServiceID                 = "codepipeline"                 
    CodestarServiceID                     = "codestar"                     
    CognitoIdentityServiceID              = "cognito-identity"             
    CognitoIdpServiceID                   = "cognito-idp"                  
    CognitoSyncServiceID                  = "cognito-sync"                 
    ComprehendServiceID                   = "comprehend"                   
    ConfigServiceID                       = "config"                       
    CurServiceID                          = "cur"                          
    DatapipelineServiceID                 = "datapipeline"                 
    DaxServiceID                          = "dax"                          
    DevicefarmServiceID                   = "devicefarm"                   
    DirectconnectServiceID                = "directconnect"                
    DiscoveryServiceID                    = "discovery"                    
    DmsServiceID                          = "dms"                          
    DsServiceID                           = "ds"                           
    DynamodbServiceID                     = "dynamodb"                     
    Ec2ServiceID                          = "ec2"                          
    Ec2metadataServiceID                  = "ec2metadata"                  
    EcrServiceID                          = "ecr"                          
    EcsServiceID                          = "ecs"                          
    ElasticacheServiceID                  = "elasticache"                  
    ElasticbeanstalkServiceID             = "elasticbeanstalk"             
    ElasticfilesystemServiceID            = "elasticfilesystem"            
    ElasticloadbalancingServiceID         = "elasticloadbalancing"         
    ElasticmapreduceServiceID             = "elasticmapreduce"             
    ElastictranscoderServiceID            = "elastictranscoder"            
    EmailServiceID                        = "email"                        
    EntitlementMarketplaceServiceID       = "entitlement.marketplace"      
    EsServiceID                           = "es"                           
    EventsServiceID                       = "events"                       
    FirehoseServiceID                     = "firehose"                     
    FmsServiceID                          = "fms"                          
    GameliftServiceID                     = "gamelift"                     
    GlacierServiceID                      = "glacier"                      
    GlueServiceID                         = "glue"                         
    GreengrassServiceID                   = "greengrass"                   
    GuarddutyServiceID                    = "guardduty"                    
    HealthServiceID                       = "health"                       
    IamServiceID                          = "iam"                          
    ImportexportServiceID                 = "importexport"                 
    InspectorServiceID                    = "inspector"                    
    IotServiceID                          = "iot"                          
    IotanalyticsServiceID                 = "iotanalytics"                 
    KinesisServiceID                      = "kinesis"                      
    KinesisanalyticsServiceID             = "kinesisanalytics"             
    KinesisvideoServiceID                 = "kinesisvideo"                 
    KmsServiceID                          = "kms"                          
    LambdaServiceID                       = "lambda"                       
    LightsailServiceID                    = "lightsail"                    
    LogsServiceID                         = "logs"                         
    MachinelearningServiceID              = "machinelearning"              
    MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" 
    MediaconvertServiceID                 = "mediaconvert"                 
    MedialiveServiceID                    = "medialive"                    
    MediapackageServiceID                 = "mediapackage"                 
    MediastoreServiceID                   = "mediastore"                   
    MeteringMarketplaceServiceID          = "metering.marketplace"         
    MghServiceID                          = "mgh"                          
    MobileanalyticsServiceID              = "mobileanalytics"              
    ModelsLexServiceID                    = "models.lex"                   
    MonitoringServiceID                   = "monitoring"                   
    MturkRequesterServiceID               = "mturk-requester"              
    NeptuneServiceID                      = "neptune"                      
    OpsworksServiceID                     = "opsworks"                     
    OpsworksCmServiceID                   = "opsworks-cm"                  
    OrganizationsServiceID                = "organizations"                
    PinpointServiceID                     = "pinpoint"                     
    PollyServiceID                        = "polly"                        
    RdsServiceID                          = "rds"                          
    RedshiftServiceID                     = "redshift"                     
    RekognitionServiceID                  = "rekognition"                  
    ResourceGroupsServiceID               = "resource-groups"              
    Route53ServiceID                      = "route53"                      
    Route53domainsServiceID               = "route53domains"               
    RuntimeLexServiceID                   = "runtime.lex"                  
    RuntimeSagemakerServiceID             = "runtime.sagemaker"            
    S3ServiceID                           = "s3"                           
    S3ControlServiceID                    = "s3-control"                   
    SagemakerServiceID                    = "api.sagemaker"                
    SdbServiceID                          = "sdb"                          
    SecretsmanagerServiceID               = "secretsmanager"               
    ServerlessrepoServiceID               = "serverlessrepo"               
    ServicecatalogServiceID               = "servicecatalog"               
    ServicediscoveryServiceID             = "servicediscovery"             
    ShieldServiceID                       = "shield"                       
    SmsServiceID                          = "sms"                          
    SnowballServiceID                     = "snowball"                     
    SnsServiceID                          = "sns"                          
    SqsServiceID                          = "sqs"                          
    SsmServiceID                          = "ssm"                          
    StatesServiceID                       = "states"                       
                   = "storagegateway"               
    StreamsDynamodbServiceID              = "streams.dynamodb"             
    StsServiceID                          = "sts"                          
    SupportServiceID                      = "support"                      
    SwfServiceID                          = "swf"                          
    TaggingServiceID                      = "tagging"                      
    TransferServiceID                     = "transfer"                     
    TranslateServiceID                    = "translate"                    
    WafServiceID                          = "waf"                          
    WafRegionalServiceID                  = "waf-regional"                 
    WorkdocsServiceID                     = "workdocs"                     
    WorkmailServiceID                     = "workmail"                     
    WorkspacesServiceID                   = "workspaces"                   
    XrayServiceID                         = "xray"                         
)

Service identifiers

Deprecated: Use client package's EndpointsID value instead of these ServiceIDs. These IDs are not maintained, and are out of date.

const (
    EuIsoeWest1RegionID = "eu-isoe-west-1" 
)

AWS ISOE (Europe) partition's regions.

const (
    UsIsobEast1RegionID = "us-isob-east-1" 
)

AWS ISOB (US) partition's regions.

func AddScheme ¶
func AddScheme(endpoint string, disableSSL bool) string

AddScheme adds the HTTP or HTTPS schemes to a endpoint URL if there is no scheme. If disableSSL is true HTTP will set HTTP instead of the default HTTPS.

If disableSSL is set, it will only set the URL's scheme if the URL does not contain a scheme.

func DisableSSLOption ¶
func DisableSSLOption(o *Options)

DisableSSLOption sets the DisableSSL options. Can be used as a functional option when resolving endpoints.

func RegionsForService ¶
func RegionsForService(ps []Partition, partitionID, serviceID string) (map[string]Region, bool)

RegionsForService returns a map of regions for the partition and service. If either the partition or service does not exist false will be returned as the second parameter.

This example shows how to get the regions for DynamoDB in the AWS partition.

rs, exists := endpoints.RegionsForService(endpoints.DefaultPartitions(), endpoints.AwsPartitionID, endpoints.DynamodbServiceID)

This is equivalent to using the partition directly.

rs := endpoints.AwsPartition().Services()[endpoints.DynamodbServiceID].Regions()
func ResolveUnknownServiceOption ¶
func ResolveUnknownServiceOption(o *Options)

ResolveUnknownServiceOption sets the ResolveUnknownService option. Can be used as a functional option when resolving endpoints.

func STSRegionalEndpointOption ¶
func STSRegionalEndpointOption(o *Options)

STSRegionalEndpointOption enables the STS endpoint resolver behavior to resolve STS endpoint to their regional endpoint, instead of the global endpoint.

func StrictMatchingOption ¶
func StrictMatchingOption(o *Options)

StrictMatchingOption sets the StrictMatching option. Can be used as a functional option when resolving endpoints.

func UseDualStackEndpointOption ¶
func UseDualStackEndpointOption(o *Options)

UseDualStackEndpointOption sets the UseDualStackEndpoint option to enabled. Can be used as a functional option when resolving endpoints.

func UseDualStackOption ¶
func UseDualStackOption(o *Options)

UseDualStackOption sets the UseDualStack option. Can be used as a functional option when resolving endpoints.

Deprecated: UseDualStackEndpointOption should be used to enable usage of a service's dual-stack endpoint. When DualStackEndpointState is set to a non-zero value it takes higher precedence then this option.

func UseFIPSEndpointOption ¶
func UseFIPSEndpointOption(o *Options)

UseFIPSEndpointOption sets the UseFIPSEndpoint option to enabled. Can be used as a functional option when resolving endpoints.

type DecodeModelOptions ¶
type DecodeModelOptions struct {
    SkipCustomizations bool
}

A DecodeModelOptions are the options for how the endpoints model definition are decoded.

func (*DecodeModelOptions) Set ¶
func (d *DecodeModelOptions) Set(optFns ...func(*DecodeModelOptions))

Set combines all of the option functions together.

type DualStackEndpointState ¶
type DualStackEndpointState uint

DualStackEndpointState is a constant to describe the dual-stack endpoint resolution behavior.

const (
    
    
    DualStackEndpointStateUnset DualStackEndpointState = iota

    
    DualStackEndpointStateEnabled

    
    DualStackEndpointStateDisabled
)
type EC2IMDSEndpointModeState ¶
type EC2IMDSEndpointModeState uint

EC2IMDSEndpointModeState is an enum configuration variable describing the client endpoint mode.

const (
    EC2IMDSEndpointModeStateUnset EC2IMDSEndpointModeState = iota
    EC2IMDSEndpointModeStateIPv4
    EC2IMDSEndpointModeStateIPv6
)

Enumeration values for EC2IMDSEndpointModeState

func (*EC2IMDSEndpointModeState) SetFromString ¶
func (e *EC2IMDSEndpointModeState) SetFromString(v string) error

SetFromString sets the EC2IMDSEndpointModeState based on the provided string value. Unknown values will default to EC2IMDSEndpointModeStateUnset

type Endpoint ¶
type Endpoint struct {
    
}

A Endpoint provides information about endpoints, and provides the ability to resolve that endpoint for the service, and the region the endpoint represents.

func (Endpoint) ID ¶
func (e Endpoint) ID() string

ID returns the identifier for an endpoint.

func (Endpoint) ResolveEndpoint ¶
func (e Endpoint) ResolveEndpoint(opts ...func(*Options)) (ResolvedEndpoint, error)

ResolveEndpoint resolves an endpoint from the context of a service and region the endpoint represents. See Partition.EndpointFor for usage and errors that can be returned.

func (Endpoint) ServiceID ¶
func (e Endpoint) ServiceID() string

ServiceID returns the identifier the endpoint belongs to.

type EndpointNotFoundError ¶
type EndpointNotFoundError struct {
    Partition string
    Service   string
    Region    string
    
}

A EndpointNotFoundError is returned when in StrictMatching mode, and the endpoint for the service and region cannot be found in any of the partitions.

type EnumPartitions ¶
type EnumPartitions interface {
    Partitions() []Partition
}

EnumPartitions a provides a way to retrieve the underlying partitions that make up the SDK's default Resolver, or any resolver decoded from a model file.

Use this interface with DefaultResolver and DecodeModels to get the list of Partitions.

▹ Example

▾ Example

Code:

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)
    }
}
type FIPSEndpointState ¶
type FIPSEndpointState uint

FIPSEndpointState is a constant to describe the FIPS endpoint resolution behavior.

const (
    
    FIPSEndpointStateUnset FIPSEndpointState = iota

    
    FIPSEndpointStateEnabled

    
    FIPSEndpointStateDisabled
)
type Logger ¶
type Logger interface {
    Log(...interface{})
}

A Logger is a minimalistic interface for the SDK to log messages to.

type Options ¶
type Options struct {
    
    
    DisableSSL bool

    
    
    
    
    
    
    
    
    
    
    
    UseDualStack bool

    
    UseDualStackEndpoint DualStackEndpointState

    
    UseFIPSEndpoint FIPSEndpointState

    
    
    
    
    StrictMatching bool

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ResolveUnknownService bool

    
    EC2MetadataEndpointMode EC2IMDSEndpointModeState

    
    STSRegionalEndpoint STSRegionalEndpoint

    
    S3UsEast1RegionalEndpoint S3UsEast1RegionalEndpoint

    
    
    ResolvedRegion string

    
    Logger Logger

    
    LogDeprecated bool
}

Options provide the configuration needed to direct how the endpoints will be resolved.

func (*Options) Set ¶
func (o *Options) Set(optFns ...func(*Options))

Set combines all of the option functions together.

type Partition ¶
type Partition struct {
    
}

A Partition provides the ability to enumerate the partition's regions and services.

func AwsCnPartition ¶
func AwsCnPartition() Partition

AwsCnPartition returns the Resolver for AWS China.

func AwsIsoBPartition ¶
func AwsIsoBPartition() Partition

AwsIsoBPartition returns the Resolver for AWS ISOB (US).

func AwsIsoEPartition ¶
func AwsIsoEPartition() Partition

AwsIsoEPartition returns the Resolver for AWS ISOE (Europe).

func AwsIsoFPartition ¶
func AwsIsoFPartition() Partition

AwsIsoFPartition returns the Resolver for AWS ISOF.

func AwsIsoPartition ¶
func AwsIsoPartition() Partition

AwsIsoPartition returns the Resolver for AWS ISO (US).

func AwsPartition ¶
func AwsPartition() Partition

AwsPartition returns the Resolver for AWS Standard.

func AwsUsGovPartition ¶
func AwsUsGovPartition() Partition

AwsUsGovPartition returns the Resolver for AWS GovCloud (US).

func DefaultPartitions ¶
func DefaultPartitions() []Partition

DefaultPartitions returns a list of the partitions the SDK is bundled with. The available partitions are: AWS Standard, AWS China, AWS GovCloud (US), AWS ISO (US), AWS ISOB (US), AWS ISOE (Europe), and AWS ISOF.

partitions := endpoints.DefaultPartitions
for _, p := range partitions {
    // ... inspect partitions
}
func PartitionForRegion ¶
func PartitionForRegion(ps []Partition, regionID string) (Partition, bool)

PartitionForRegion returns the first partition which includes the region passed in. This includes both known regions and regions which match a pattern supported by the partition which may include regions that are not explicitly known by the partition. Use the Regions method of the returned Partition if explicit support is needed.

func (Partition) DNSSuffix ¶
func (p Partition) DNSSuffix() string

DNSSuffix returns the base domain name of the partition.

func (Partition) EndpointFor ¶
func (p Partition) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error)

EndpointFor attempts to resolve the endpoint based on service and region. See Options for information on configuring how the endpoint is resolved.

If the service cannot be found in the metadata the UnknownServiceError error will be returned. This validation will occur regardless if StrictMatching is enabled. To enable resolving unknown services set the "ResolveUnknownService" option to true. When StrictMatching is disabled this option allows the partition resolver to resolve a endpoint based on the service endpoint ID provided.

When resolving endpoints you can choose to enable StrictMatching. This will require the provided service and region to be known by the partition. If the endpoint cannot be strictly resolved an error will be returned. This mode is useful to ensure the endpoint resolved is valid. Without StrictMatching enabled the endpoint returned may look valid but may not work. StrictMatching requires the SDK to be updated if you want to take advantage of new regions and services expansions.

Errors that can be returned.

func (Partition) ID ¶
func (p Partition) ID() string

ID returns the identifier of the partition.

func (Partition) Regions ¶
func (p Partition) Regions() map[string]Region

Regions returns a map of Regions indexed by their ID. This is useful for enumerating over the regions in a partition.

func (Partition) Services ¶
func (p Partition) Services() map[string]Service

Services returns a map of Service indexed by their ID. This is useful for enumerating over the services in a partition.

type Region ¶
type Region struct {
    
}

A Region provides information about a region, and ability to resolve an endpoint from the context of a region, given a service.

func (Region) Description ¶
func (r Region) Description() string

Description returns the region's description. The region description is free text, it can be empty, and it may change between SDK releases.

func (Region) ID ¶
func (r Region) ID() string

ID returns the region's identifier.

func (Region) ResolveEndpoint ¶
func (r Region) ResolveEndpoint(service string, opts ...func(*Options)) (ResolvedEndpoint, error)

ResolveEndpoint resolves an endpoint from the context of the region given a service. See Partition.EndpointFor for usage and errors that can be returned.

func (Region) Services ¶
func (r Region) Services() map[string]Service

Services returns a list of all services that are known to be in this region.

type ResolvedEndpoint ¶
type ResolvedEndpoint struct {
    
    URL string

    
    PartitionID string

    
    SigningRegion string

    
    SigningName string

    
    
    SigningNameDerived bool

    
    SigningMethod string
}

A ResolvedEndpoint is an endpoint that has been resolved based on a partition service, and region.

type Resolver ¶
type Resolver interface {
    EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error)
}

A Resolver provides the interface for functionality to resolve endpoints. The build in Partition and DefaultResolver return value satisfy this interface.

func DecodeModel ¶
func DecodeModel(r io.Reader, optFns ...func(*DecodeModelOptions)) (Resolver, error)

DecodeModel unmarshals a Regions and Endpoint model definition file into a endpoint Resolver. If the file format is not supported, or an error occurs when unmarshaling the model an error will be returned.

Casting the return value of this func to a EnumPartitions will allow you to get a list of the partitions in the order the endpoints will be resolved in.

resolver, err := endpoints.DecodeModel(reader)

partitions := resolver.(endpoints.EnumPartitions).Partitions()
for _, p := range partitions {
    // ... inspect partitions
}
func DefaultResolver ¶
func DefaultResolver() Resolver

DefaultResolver returns an Endpoint resolver that will be able to resolve endpoints for: AWS Standard, AWS China, AWS GovCloud (US), AWS ISO (US), AWS ISOB (US), AWS ISOE (Europe), and AWS ISOF.

Use DefaultPartitions() to get the list of the default partitions.

type ResolverFunc ¶
type ResolverFunc func(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error)

ResolverFunc is a helper utility that wraps a function so it satisfies the Resolver interface. This is useful when you want to add additional endpoint resolving logic, or stub out specific endpoints with custom values.

▹ Example

▾ Example

Code:

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),
}))




s3Svc := s3.New(sess)

s3Svc.GetObject(&s3.GetObjectInput{
    Bucket: aws.String("myBucket"),
    Key:    aws.String("myObjectKey"),
})




sqsSvc := sqs.New(sess)


sqsSvc.ReceiveMessage(&sqs.ReceiveMessageInput{
    QueueUrl: aws.String("my-queue-url"),
})
func (ResolverFunc) EndpointFor ¶
func (fn ResolverFunc) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error)

EndpointFor wraps the ResolverFunc function to satisfy the Resolver interface.

type S3UsEast1RegionalEndpoint ¶
type S3UsEast1RegionalEndpoint int

S3UsEast1RegionalEndpoint is an enum for the states of the S3 us-east-1 Regional Endpoint options.

const (

    
    
    UnsetS3UsEast1Endpoint S3UsEast1RegionalEndpoint = iota

    
    
    LegacyS3UsEast1Endpoint

    
    
    RegionalS3UsEast1Endpoint
)
func GetS3UsEast1RegionalEndpoint ¶
func GetS3UsEast1RegionalEndpoint(s string) (S3UsEast1RegionalEndpoint, error)

GetS3UsEast1RegionalEndpoint function returns the S3UsEast1RegionalEndpointFlag based on the input string provided in env config or shared config by the user.

`legacy`, `regional` are the only case-insensitive valid strings for resolving the S3 regional Endpoint flag.

func (S3UsEast1RegionalEndpoint) String ¶
func (e S3UsEast1RegionalEndpoint) String() string
type STSRegionalEndpoint ¶
type STSRegionalEndpoint int

STSRegionalEndpoint is an enum for the states of the STS Regional Endpoint options.

const (

    
    UnsetSTSEndpoint STSRegionalEndpoint = iota

    
    
    LegacySTSEndpoint

    
    
    RegionalSTSEndpoint
)
func GetSTSRegionalEndpoint ¶
func GetSTSRegionalEndpoint(s string) (STSRegionalEndpoint, error)

GetSTSRegionalEndpoint function returns the STSRegionalEndpointFlag based on the input string provided in env config or shared config by the user.

`legacy`, `regional` are the only case-insensitive valid strings for resolving the STS regional Endpoint flag.

func (STSRegionalEndpoint) String ¶
func (e STSRegionalEndpoint) String() string
type Service ¶
type Service struct {
    
}

A Service provides information about a service, and ability to resolve an endpoint from the context of a service, given a region.

func (Service) Endpoints ¶
func (s Service) Endpoints() map[string]Endpoint

Endpoints returns a map of Endpoints indexed by their ID for all known endpoints for a service.

A region is the AWS region the service exists in. Whereas a Endpoint is an URL that can be resolved to a instance of a service.

func (Service) ID ¶
func (s Service) ID() string

ID returns the identifier for the service.

func (Service) Regions ¶
func (s Service) Regions() map[string]Region

Regions returns a map of Regions that the service is present in.

A region is the AWS region the service exists in. Whereas a Endpoint is an URL that can be resolved to a instance of a service.

func (Service) ResolveEndpoint ¶
func (s Service) ResolveEndpoint(region string, opts ...func(*Options)) (ResolvedEndpoint, error)

ResolveEndpoint resolves an endpoint from the context of a service given a region. See Partition.EndpointFor for usage and errors that can be returned.

type UnknownEndpointError ¶
type UnknownEndpointError struct {
    Partition string
    Service   string
    Region    string
    Known     []string
    
}

A UnknownEndpointError is returned when in StrictMatching mode and the service is valid, but the region does not resolve to an endpoint. Includes a list of all known endpoints for the service.

func NewUnknownEndpointError ¶
func NewUnknownEndpointError(p, s, r string, known []string) UnknownEndpointError

NewUnknownEndpointError builds and returns UnknownEndpointError.

func (UnknownEndpointError) Error ¶
func (e UnknownEndpointError) Error() string

String returns the string representation of the error.

func (UnknownEndpointError) String ¶
func (e UnknownEndpointError) String() string

String returns the string representation of the error.

type UnknownServiceError ¶
type UnknownServiceError struct {
    Partition string
    Service   string
    Known     []string
    
}

A UnknownServiceError is returned when the service does not resolve to an endpoint. Includes a list of all known services for the partition. Returned when a partition does not support the service.

func NewUnknownServiceError ¶
func NewUnknownServiceError(p, s string, known []string) UnknownServiceError

NewUnknownServiceError builds and returns UnknownServiceError.

func (UnknownServiceError) Error ¶
func (e UnknownServiceError) Error() string

String returns the string representation of the error.

func (UnknownServiceError) String ¶
func (e UnknownServiceError) String() string

String returns the string representation of the error.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4