Package: endpoints

import "../ibm-cos-sdk-go/aws/endpoints"

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

Constants

const AwsPartitionID = readonly

Value:

"aws" // AWS Standard partition.
const AwsCnPartitionID = readonly

Value:

"aws-cn" // AWS China partition.
const AwsUsGovPartitionID = readonly

Value:

"aws-us-gov" // AWS GovCloud (US) partition.
const AwsIsoPartitionID = readonly

Value:

"aws-iso" // AWS ISO (US) partition.
const AwsIsoBPartitionID = readonly

Value:

"aws-iso-b" // AWS ISOB (US) partition.
const AfSouth1RegionID = readonly

Value:

"af-south-1" // Africa (Cape Town).
const ApEast1RegionID = readonly

Value:

"ap-east-1" // Asia Pacific (Hong Kong).
const ApNortheast1RegionID = readonly

Value:

"ap-northeast-1" // Asia Pacific (Tokyo).
const ApNortheast2RegionID = readonly

Value:

"ap-northeast-2" // Asia Pacific (Seoul).
const ApNortheast3RegionID = readonly

Value:

"ap-northeast-3" // Asia Pacific (Osaka).
const ApSouth1RegionID = readonly

Value:

"ap-south-1" // Asia Pacific (Mumbai).
const ApSoutheast1RegionID = readonly

Value:

"ap-southeast-1" // Asia Pacific (Singapore).
const ApSoutheast2RegionID = readonly

Value:

"ap-southeast-2" // Asia Pacific (Sydney).
const CaCentral1RegionID = readonly

Value:

"ca-central-1" // Canada (Central).
const EuCentral1RegionID = readonly

Value:

"eu-central-1" // Europe (Frankfurt).
const EuNorth1RegionID = readonly

Value:

"eu-north-1" // Europe (Stockholm).
const EuSouth1RegionID = readonly

Value:

"eu-south-1" // Europe (Milan).
const EuWest1RegionID = readonly

Value:

"eu-west-1" // Europe (Ireland).
const EuWest2RegionID = readonly

Value:

"eu-west-2" // Europe (London).
const EuWest3RegionID = readonly

Value:

"eu-west-3" // Europe (Paris).
const MeSouth1RegionID = readonly

Value:

"me-south-1" // Middle East (Bahrain).
const SaEast1RegionID = readonly

Value:

"sa-east-1" // South America (Sao Paulo).
const UsEast1RegionID = readonly

Value:

"us-east-1" // US East (N. Virginia).
const UsEast2RegionID = readonly

Value:

"us-east-2" // US East (Ohio).
const UsWest1RegionID = readonly

Value:

"us-west-1" // US West (N. California).
const UsWest2RegionID = readonly

Value:

"us-west-2" // US West (Oregon).
const CnNorth1RegionID = readonly

Value:

"cn-north-1" // China (Beijing).
const CnNorthwest1RegionID = readonly

Value:

"cn-northwest-1" // China (Ningxia).
const UsGovEast1RegionID = readonly

Value:

"us-gov-east-1" // AWS GovCloud (US-East).
const UsGovWest1RegionID = readonly

Value:

"us-gov-west-1" // AWS GovCloud (US-West).
const UsIsoEast1RegionID = readonly

Value:

"us-iso-east-1" // US ISO East.
const UsIsobEast1RegionID = readonly

Value:

"us-isob-east-1" // US ISOB East (Ohio).
const DualStackEndpointStateUnset DualStackEndpointState = readonly

DualStackEndpointStateUnset is the default value behavior for dual-stack endpoint resolution.

Value:

iota
const UnsetS3UsEast1Endpoint S3UsEast1RegionalEndpoint = readonly

UnsetS3UsEast1Endpoint represents that S3 Regional Endpoint flag is not specified.

Value:

iota
const A4bServiceID = readonly

Value:

"a4b" // A4b.
const AcmServiceID = readonly

Value:

"acm" // Acm.
const AcmPcaServiceID = readonly

Value:

"acm-pca" // AcmPca.
const ApiMediatailorServiceID = readonly

Value:

"api.mediatailor" // ApiMediatailor.
const ApiPricingServiceID = readonly

Value:

"api.pricing" // ApiPricing.
const ApiSagemakerServiceID = readonly

Value:

"api.sagemaker" // ApiSagemaker.
const ApigatewayServiceID = readonly

Value:

"apigateway" // Apigateway.
const ApplicationAutoscalingServiceID = readonly

Value:

"application-autoscaling" // ApplicationAutoscaling.
const Appstream2ServiceID = readonly

Value:

"appstream2" // Appstream2.
const AppsyncServiceID = readonly

Value:

"appsync" // Appsync.
const AthenaServiceID = readonly

Value:

"athena" // Athena.
const AutoscalingServiceID = readonly

Value:

"autoscaling" // Autoscaling.
const AutoscalingPlansServiceID = readonly

Value:

"autoscaling-plans" // AutoscalingPlans.
const BatchServiceID = readonly

Value:

"batch" // Batch.
const BudgetsServiceID = readonly

Value:

"budgets" // Budgets.
const CeServiceID = readonly

Value:

"ce" // Ce.
const ChimeServiceID = readonly

Value:

"chime" // Chime.
const Cloud9ServiceID = readonly

Value:

"cloud9" // Cloud9.
const ClouddirectoryServiceID = readonly

Value:

"clouddirectory" // Clouddirectory.
const CloudformationServiceID = readonly

Value:

"cloudformation" // Cloudformation.
const CloudfrontServiceID = readonly

Value:

"cloudfront" // Cloudfront.
const CloudhsmServiceID = readonly

Value:

"cloudhsm" // Cloudhsm.
const Cloudhsmv2ServiceID = readonly

Value:

"cloudhsmv2" // Cloudhsmv2.
const CloudsearchServiceID = readonly

Value:

"cloudsearch" // Cloudsearch.
const CloudtrailServiceID = readonly

Value:

"cloudtrail" // Cloudtrail.
const CodebuildServiceID = readonly

Value:

"codebuild" // Codebuild.
const CodecommitServiceID = readonly

Value:

"codecommit" // Codecommit.
const CodedeployServiceID = readonly

Value:

"codedeploy" // Codedeploy.
const CodepipelineServiceID = readonly

Value:

"codepipeline" // Codepipeline.
const CodestarServiceID = readonly

Value:

"codestar" // Codestar.
const CognitoIdentityServiceID = readonly

Value:

"cognito-identity" // CognitoIdentity.
const CognitoIdpServiceID = readonly

Value:

"cognito-idp" // CognitoIdp.
const CognitoSyncServiceID = readonly

Value:

"cognito-sync" // CognitoSync.
const ComprehendServiceID = readonly

Value:

"comprehend" // Comprehend.
const ConfigServiceID = readonly

Value:

"config" // Config.
const CurServiceID = readonly

Value:

"cur" // Cur.
const DatapipelineServiceID = readonly

Value:

"datapipeline" // Datapipeline.
const DaxServiceID = readonly

Value:

"dax" // Dax.
const DevicefarmServiceID = readonly

Value:

"devicefarm" // Devicefarm.
const DirectconnectServiceID = readonly

Value:

"directconnect" // Directconnect.
const DiscoveryServiceID = readonly

Value:

"discovery" // Discovery.
const DmsServiceID = readonly

Value:

"dms" // Dms.
const DsServiceID = readonly

Value:

"ds" // Ds.
const DynamodbServiceID = readonly

Value:

"dynamodb" // Dynamodb.
const Ec2ServiceID = readonly

Value:

"ec2" // Ec2.
const Ec2metadataServiceID = readonly

Value:

"ec2metadata" // Ec2metadata.
const EcrServiceID = readonly

Value:

"ecr" // Ecr.
const EcsServiceID = readonly

Value:

"ecs" // Ecs.
const ElasticacheServiceID = readonly

Value:

"elasticache" // Elasticache.
const ElasticbeanstalkServiceID = readonly

Value:

"elasticbeanstalk" // Elasticbeanstalk.
const ElasticfilesystemServiceID = readonly

Value:

"elasticfilesystem" // Elasticfilesystem.
const ElasticloadbalancingServiceID = readonly

Value:

"elasticloadbalancing" // Elasticloadbalancing.
const ElasticmapreduceServiceID = readonly

Value:

"elasticmapreduce" // Elasticmapreduce.
const ElastictranscoderServiceID = readonly

Value:

"elastictranscoder" // Elastictranscoder.
const EmailServiceID = readonly

Value:

"email" // Email.
const EntitlementMarketplaceServiceID = readonly

Value:

"entitlement.marketplace" // EntitlementMarketplace.
const EsServiceID = readonly

Value:

"es" // Es.
const EventsServiceID = readonly

Value:

"events" // Events.
const FirehoseServiceID = readonly

Value:

"firehose" // Firehose.
const FmsServiceID = readonly

Value:

"fms" // Fms.
const GameliftServiceID = readonly

Value:

"gamelift" // Gamelift.
const GlacierServiceID = readonly

Value:

"glacier" // Glacier.
const GlueServiceID = readonly

Value:

"glue" // Glue.
const GreengrassServiceID = readonly

Value:

"greengrass" // Greengrass.
const GuarddutyServiceID = readonly

Value:

"guardduty" // Guardduty.
const HealthServiceID = readonly

Value:

"health" // Health.
const IamServiceID = readonly

Value:

"iam" // Iam.
const ImportexportServiceID = readonly

Value:

"importexport" // Importexport.
const InspectorServiceID = readonly

Value:

"inspector" // Inspector.
const IotServiceID = readonly

Value:

"iot" // Iot.
const IotanalyticsServiceID = readonly

Value:

"iotanalytics" // Iotanalytics.
const KinesisServiceID = readonly

Value:

"kinesis" // Kinesis.
const KinesisanalyticsServiceID = readonly

Value:

"kinesisanalytics" // Kinesisanalytics.
const KinesisvideoServiceID = readonly

Value:

"kinesisvideo" // Kinesisvideo.
const KmsServiceID = readonly

Value:

"kms" // Kms.
const LambdaServiceID = readonly

Value:

"lambda" // Lambda.
const LightsailServiceID = readonly

Value:

"lightsail" // Lightsail.
const LogsServiceID = readonly

Value:

"logs" // Logs.
const MachinelearningServiceID = readonly

Value:

"machinelearning" // Machinelearning.
const MarketplacecommerceanalyticsServiceID = readonly

Value:

"marketplacecommerceanalytics" // Marketplacecommerceanalytics.
const MediaconvertServiceID = readonly

Value:

"mediaconvert" // Mediaconvert.
const MedialiveServiceID = readonly

Value:

"medialive" // Medialive.
const MediapackageServiceID = readonly

Value:

"mediapackage" // Mediapackage.
const MediastoreServiceID = readonly

Value:

"mediastore" // Mediastore.
const MeteringMarketplaceServiceID = readonly

Value:

"metering.marketplace" // MeteringMarketplace.
const MghServiceID = readonly

Value:

"mgh" // Mgh.
const MobileanalyticsServiceID = readonly

Value:

"mobileanalytics" // Mobileanalytics.
const ModelsLexServiceID = readonly

Value:

"models.lex" // ModelsLex.
const MonitoringServiceID = readonly

Value:

"monitoring" // Monitoring.
const MturkRequesterServiceID = readonly

Value:

"mturk-requester" // MturkRequester.
const NeptuneServiceID = readonly

Value:

"neptune" // Neptune.
const OpsworksServiceID = readonly

Value:

"opsworks" // Opsworks.
const OpsworksCmServiceID = readonly

Value:

"opsworks-cm" // OpsworksCm.
const OrganizationsServiceID = readonly

Value:

"organizations" // Organizations.
const PinpointServiceID = readonly

Value:

"pinpoint" // Pinpoint.
const PollyServiceID = readonly

Value:

"polly" // Polly.
const RdsServiceID = readonly

Value:

"rds" // Rds.
const RedshiftServiceID = readonly

Value:

"redshift" // Redshift.
const RekognitionServiceID = readonly

Value:

"rekognition" // Rekognition.
const ResourceGroupsServiceID = readonly

Value:

"resource-groups" // ResourceGroups.
const Route53ServiceID = readonly

Value:

"route53" // Route53.
const Route53domainsServiceID = readonly

Value:

"route53domains" // Route53domains.
const RuntimeLexServiceID = readonly

Value:

"runtime.lex" // RuntimeLex.
const RuntimeSagemakerServiceID = readonly

Value:

"runtime.sagemaker" // RuntimeSagemaker.
const S3ServiceID = readonly

Value:

"s3" // S3.
const S3ControlServiceID = readonly

Value:

"s3-control" // S3Control.
const SagemakerServiceID = readonly

Value:

"api.sagemaker" // Sagemaker.
const SdbServiceID = readonly

Value:

"sdb" // Sdb.
const SecretsmanagerServiceID = readonly

Value:

"secretsmanager" // Secretsmanager.
const ServerlessrepoServiceID = readonly

Value:

"serverlessrepo" // Serverlessrepo.
const ServicecatalogServiceID = readonly

Value:

"servicecatalog" // Servicecatalog.
const ServicediscoveryServiceID = readonly

Value:

"servicediscovery" // Servicediscovery.
const ShieldServiceID = readonly

Value:

"shield" // Shield.
const SmsServiceID = readonly

Value:

"sms" // Sms.
const SnowballServiceID = readonly

Value:

"snowball" // Snowball.
const SnsServiceID = readonly

Value:

"sns" // Sns.
const SqsServiceID = readonly

Value:

"sqs" // Sqs.
const SsmServiceID = readonly

Value:

"ssm" // Ssm.
const StatesServiceID = readonly

Value:

"states" // States.
const StoragegatewayServiceID = readonly

Value:

"storagegateway" // Storagegateway.
const StreamsDynamodbServiceID = readonly

Value:

"streams.dynamodb" // StreamsDynamodb.
const StsServiceID = readonly

Value:

"sts" // Sts.
const SupportServiceID = readonly

Value:

"support" // Support.
const SwfServiceID = readonly

Value:

"swf" // Swf.
const TaggingServiceID = readonly

Value:

"tagging" // Tagging.
const TransferServiceID = readonly

Value:

"transfer" // Transfer.
const TranslateServiceID = readonly

Value:

"translate" // Translate.
const WafServiceID = readonly

Value:

"waf" // Waf.
const WafRegionalServiceID = readonly

Value:

"waf-regional" // WafRegional.
const WorkdocsServiceID = readonly

Value:

"workdocs" // Workdocs.
const WorkmailServiceID = readonly

Value:

"workmail" // Workmail.
const WorkspacesServiceID = readonly

Value:

"workspaces" // Workspaces.
const XrayServiceID = readonly

Value:

"xray" // Xray.

Type Summary collapse

Interface Summary collapse

Function Summary collapse

Type Details

EndpointNotFoundError struct

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

Structure Fields:

Partition string
Service string
Region string

ResolvedEndpoint struct

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

Structure Fields:

URL string

The endpoint URL

PartitionID string

The endpoint partition

SigningRegion string

The region that should be used for signing requests.

SigningName string

The service name that should be used for signing requests.

SigningNameDerived bool

States that the signing name for this endpoint was derived from metadata passed in, but was not explicitly modeled.

SigningMethod string

The signing method that should be used for signing requests.

S3UsEast1RegionalEndpoint struct

Structure Fields:

(empty struct)

Function Details

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.



236
237
238
239
240
241
242
243
244
245
246
// File 'aws/endpoints/endpoints.go', line 236

func AddScheme(endpoint string, disableSSL bool) string { if !schemeRE.MatchString(endpoint) { scheme := "https" if disableSSL { scheme = "http" } endpoint = fmt.Sprintf("%s://%s", scheme, endpoint) } return endpoint }

func AwsCnPartition() Partition

AwsCnPartition returns the Resolver for AWS China.



13427
13428
13429
// File 'aws/endpoints/defaults.go', line 13427

func AwsCnPartition() Partition { return awscnPartition.Partition() }

func AwsIsoBPartition() Partition

AwsIsoBPartition returns the Resolver for AWS ISOB (US).



17593
17594
17595
// File 'aws/endpoints/defaults.go', line 17593

func AwsIsoBPartition() Partition { return awsisobPartition.Partition() }

func AwsIsoPartition() Partition

AwsIsoPartition returns the Resolver for AWS ISO (US).



17098
17099
17100
// File 'aws/endpoints/defaults.go', line 17098

func AwsIsoPartition() Partition { return awsisoPartition.Partition() }

func AwsPartition() Partition

AwsPartition returns the Resolver for AWS Standard.



92
93
94
// File 'aws/endpoints/defaults.go', line 92

func AwsPartition() Partition { return awsPartition.Partition() }

func AwsUsGovPartition() Partition

AwsUsGovPartition returns the Resolver for AWS GovCloud (US).



14629
14630
14631
// File 'aws/endpoints/defaults.go', line 14629

func AwsUsGovPartition() Partition { return awsusgovPartition.Partition() }

func CodeGenModel(modelFile io.Reader, outFile io.Writer, optFns ...func(*CodeGenOptions)) error

CodeGenModel given a endpoints model file will decode it and attempt to generate Go code from the model definition. Error will be returned if the code is unable to be generated, or decoded.



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
// File 'aws/endpoints/v3model_codegen.go', line 35

func CodeGenModel(modelFile io.Reader, outFile io.Writer, optFns ...func(*CodeGenOptions)) error { var opts CodeGenOptions opts.Set(optFns...) resolver, err := DecodeModel(modelFile, func(d *DecodeModelOptions) { *d = opts.DecodeModelOptions }) if err != nil { return err } v := struct { Resolver CodeGenOptions }{ Resolver: resolver, CodeGenOptions: opts, } tmpl := template.Must(template.New("tmpl").Funcs(funcMap).Parse(v3Tmpl)) if err := tmpl.ExecuteTemplate(outFile, "defaults", v); err != nil { return fmt.Errorf("failed to execute template, %v", err) } return nil }

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 }


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
// File 'aws/endpoints/decode.go', line 39

func DecodeModel(r io.Reader, optFns ...func(*DecodeModelOptions)) (Resolver, error) { var opts DecodeModelOptions opts.Set(optFns...) // Get the version of the partition file to determine what // unmarshaling model to use. modelDef := modelDefinition{} if err := json.NewDecoder(r).Decode(&modelDef); err != nil { return nil, newDecodeModelError("failed to decode endpoints model", err) } var version string if b, ok := modelDef["version"]; ok { version = string(b) } else { return nil, newDecodeModelError("endpoints version not found in model", nil) } if version == "3" { return decodeV3Endpoints(modelDef, opts) } return nil, newDecodeModelError( fmt.Sprintf("endpoints version %s, not supported", version), nil) }

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), and AWS ISOB (US).

partitions := endpoints.DefaultPartitions for _, p := range partitions { // … inspect partitions }



79
80
81
// File 'aws/endpoints/defaults.go', line 79

func DefaultPartitions() []Partition { return defaultPartitions.Partitions() }

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), and AWS ISOB (US).

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



68
69
70
// File 'aws/endpoints/defaults.go', line 68

func DefaultResolver() Resolver { return defaultPartitions }

func DisableSSLOption(o *Options)

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



182
183
184
// File 'aws/endpoints/endpoints.go', line 182

func DisableSSLOption(o *Options) { o.DisableSSL = true }

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.



161
162
163
164
165
166
167
168
169
170
171
// File 'aws/endpoints/endpoints.go', line 161

func GetS3UsEast1RegionalEndpoint(s string) (S3UsEast1RegionalEndpoint, error) { switch { case strings.EqualFold(s, "legacy"): return LegacyS3UsEast1Endpoint, nil case strings.EqualFold(s, "regional"): return RegionalS3UsEast1Endpoint, nil default: return UnsetS3UsEast1Endpoint, fmt.Errorf("unable to resolve the value of S3UsEast1RegionalEndpoint for %v", s) } }

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

NewUnknownEndpointError builds and returns UnknownEndpointError.



571
572
573
574
575
576
577
578
579
580
// File 'aws/endpoints/endpoints.go', line 571

func NewUnknownEndpointError(p, s, r string, known []string) UnknownEndpointError { return UnknownEndpointError{ awsError: awserr.New("UnknownEndpointError", "could not resolve endpoint", nil), Partition: p, Service: s, Region: r, Known: known, } }

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

NewUnknownServiceError builds and returns UnknownServiceError.



534
535
536
537
538
539
540
541
542
// File 'aws/endpoints/endpoints.go', line 534

func NewUnknownServiceError(p, s string, known []string) UnknownServiceError { return UnknownServiceError{ awsError: awserr.New("UnknownServiceError", "could not resolve endpoint for unknown service", nil), Partition: p, Service: s, Known: known, } }

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.



293
294
295
296
297
298
299
300
301
// File 'aws/endpoints/endpoints.go', line 293

func PartitionForRegion(ps []Partition, regionID string) (Partition, bool) { for _, p := range ps { if _, ok := p.p.Regions[regionID]; ok || p.p.RegionRegex.MatchString(regionID) { return p, true } } return Partition{}, false }

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()


269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
// File 'aws/endpoints/endpoints.go', line 269

func RegionsForService(ps []Partition, partitionID, serviceID string) (map[string]Region, bool) { for _, p := range ps { if p.ID() != partitionID { continue } if _, ok := p.p.Services[serviceID]; !ok { break } s := Service{ id: serviceID, p: p.p, } return s.Regions(), true } return map[string]Region{}, false }

func ResolveUnknownServiceOption(o *Options)

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



209
210
211
// File 'aws/endpoints/endpoints.go', line 209

func ResolveUnknownServiceOption(o *Options) { o.ResolveUnknownService = true }

func StrictMatchingOption(o *Options)

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



203
204
205
// File 'aws/endpoints/endpoints.go', line 203

func StrictMatchingOption(o *Options) { o.StrictMatching = true }

func UseDualStackEndpointOption(o *Options)

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



197
198
199
// File 'aws/endpoints/endpoints.go', line 197

func UseDualStackEndpointOption(o *Options) { o.UseDualStackEndpoint = DualStackEndpointStateEnabled }

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.



191
192
193
// File 'aws/endpoints/endpoints.go', line 191

func UseDualStackOption(o *Options) { o.UseDualStack = true }