Documentation
¶
Index ¶
- Constants
- type Endpoint
- type Partition
- func (p Partition) DNSSuffix() string
- func (p Partition) Endpoint(service, region string, opts ResolveOptions) (aws.Endpoint, error)
- func (p Partition) ID() string
- func (p Partition) Regions() map[string]Region
- func (p Partition) RegionsForService(id string) (map[string]Region, bool)
- func (p Partition) Resolver() *Resolver
- func (p Partition) Services() map[string]Service
- type Partitions
- type Region
- type ResolveOptions
- type Resolver
- type Service
- type UnknownEndpointError
- type UnknownServiceError
Constants ¶
const ( JpEast1RegionID = "jp-east-1" // jp-east-1. JpEast2RegionID = "jp-east-2" // jp-east-2. JpEast3RegionID = "jp-east-3" // jp-east-3. JpEast4RegionID = "jp-east-4" // jp-east-4. JpWest1RegionID = "jp-west-1" // jp-west-1. UsEast1RegionID = "us-east-1" // us-east-1. )
NIFCLOUD Standard partition's regions.
const (
NifcloudPartitionID = "nifcloud" // NIFCLOUD Standard partition.
)
Partition identifiers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
A Endpoint provides information about endpoints, and provides the ability to resolve that endpoint for the service, and the region the endpoint represents.
type Partition ¶
type Partition struct {
// contains filtered or unexported fields
}
A Partition provides the ability to enumerate the partition's regions and services.
func NifcloudPartition ¶
func NifcloudPartition() Partition
NifcloudPartition returns the Resolver for NIFCLOUD Standard.
func (Partition) DNSSuffix ¶ added in v0.0.5
DNSSuffix returns the base domain name of the partition.
func (Partition) Endpoint ¶
Endpoint 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 endpoint will be resolved based on the parition's endpoint pattern, and service endpoint prefix.
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 my 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.
- UnknownServiceError
- UnknownEndpointError
func (Partition) Regions ¶
Regions returns a map of Regions indexed by their ID. This is useful for enumerating over the regions in a partition.
func (Partition) RegionsForService ¶
RegionsForService returns the map of regions for the service id specified. false is returned if the service is not found in the partition.
type Partitions ¶
type Partitions []Partition
Partitions is a slice of paritions describing regions and endpoints
func DefaultPartitions ¶
func DefaultPartitions() Partitions
DefaultPartitions returns a list of the partitions the SDK is bundled with. The available partitions are: NIFCLOUD Standard.
partitions := endpoints.DefaultPartitions for _, p := range partitions { // ... inspect partitions }
func (Partitions) ForPartition ¶
func (ps Partitions) ForPartition(id string) (Partition, bool)
ForPartition returns the parition with the matching ID passed in.
func (Partitions) ForRegion ¶
func (ps Partitions) ForRegion(id string) (Partition, bool)
ForRegion 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.
type Region ¶
type Region struct {
// contains filtered or unexported fields
}
A Region provides information about a region, and ability to resolve an endpoint from the context of a region, given a service.
type ResolveOptions ¶
type ResolveOptions struct { // DisableSSL forces the endpoint to be resolved as HTTP. // instead of HTTPS if the service supports it. DisableSSL bool // Sets the resolver to resolve the endpoint as a dualstack endpoint // for the service. If dualstack support for a service is not known and // StrictMatching is not enabled a dualstack endpoint for the service will // be returned. This endpoint may not be valid. If StrictMatching is // enabled only services that are known to support dualstack will return // dualstack endpoints. UseDualStack bool // Enables strict matching of services and regions resolved endpoints. // If the partition doesn't enumerate the exact service and region an // error will be returned. This option will prevent returning endpoints // that look valid, but may not resolve to any real endpoint. StrictMatching bool }
ResolveOptions provide the configuration needed to direct how the endpoints will be resolved.
type Resolver ¶
type Resolver struct { ResolveOptions // contains filtered or unexported fields }
A Resolver provides endpoint resolution based on modeled endpoint data.
func NewDefaultResolver ¶
func NewDefaultResolver() *Resolver
NewDefaultResolver returns an Endpoint resolver that will be able to resolve endpoints for: NIFCLOUD Standard.
Use DefaultPartitions() to get the list of the default partitions.
func (*Resolver) Partitions ¶
func (r *Resolver) Partitions() Partitions
Partitions returns the partitions that make up the resolver.
func (*Resolver) ResolveEndpoint ¶
ResolveEndpoint attempts to resolve an endpoint againsted the modeled endpoint data. If an endpoint is found it will be returned. An error will be returned otherwise.
Searches through the partitions in the order they are defined.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
A Service provides information about a service, and ability to resolve an endpoint from the context of a service, given a region.
func (Service) Endpoint ¶
Endpoint 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 // contains filtered or unexported fields }
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 // contains filtered or unexported fields }
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.