Documentation
¶
Overview ¶
Package endpointstrategy formats and parses the resource URLs that LocalStack's *_ENDPOINT_STRATEGY options select (SQS queue URLs, OpenSearch domain endpoints, AppSync GraphQL URIs, ECR registry hosts). The zero value of every strategy keeps the pre-existing Gopherstack URL shape.
Index ¶
- Constants
- Variables
- func ECRRegistryHost(strategy, hostPort, account, region string) string
- func GraphQLURI(strategy, base, apiID string) string
- func IsSQSQueuePath(path string) bool
- func OpenSearchEndpoint(strategy, hostPort, engine, region, account, name string) string
- func ParseGraphQLRequest(host, path string) (string, string, bool)
- func SQSQueueURL(strategy, scheme, requestHost, region, account, name string) string
- func SQSRegion(host, path string) string
- type Config
- type Flags
- type OpenSearchRequest
- type Provider
Constants ¶
const LocalDomain = "localhost.localstack.cloud"
LocalDomain is the public DNS zone that resolves every subdomain to loopback.
Variables ¶
var ErrInvalidStrategy = errors.New("invalid endpoint strategy")
ErrInvalidStrategy is returned for an unknown or unsupported strategy value.
Functions ¶
func ECRRegistryHost ¶
ECRRegistryHost formats the host part of a repository URI. An empty strategy returns "".
func GraphQLURI ¶
GraphQLURI formats an AppSync GraphQL endpoint. base is the gateway URL (scheme://host:port); an empty strategy keeps base/v1/apis/<id>/graphql.
func IsSQSQueuePath ¶
IsSQSQueuePath reports whether path has a queue-URL shape (/acct/name or /queue/region/acct/name).
func OpenSearchEndpoint ¶
OpenSearchEndpoint formats a domain endpoint (no scheme). engine is "opensearch" or "es". An empty strategy keeps the AWS-style search-<name>-<account>.<region>.es.amazonaws.com host.
func ParseGraphQLRequest ¶
ParseGraphQLRequest returns the API id and the sub-path below the graphql endpoint for a strategy-addressed request, or ok=false.
func SQSQueueURL ¶
SQSQueueURL formats a queue URL. requestHost is the host:port the client used; an empty strategy or "off" keeps the Gopherstack shape scheme://host/account/name.
Types ¶
type Config ¶
type Config struct {
SQS string
OpenSearch string
GraphQL string
ECR string
// OpenSearchMultiCluster is "false" to share one index store across domains; anything else isolates per domain.
OpenSearchMultiCluster string
// OpenSearchCustomBackend is the base URL data-plane requests are proxied to; empty uses the built-in engine.
OpenSearchCustomBackend string
// HostPort is the gateway address (host:port) used when a strategy needs one.
HostPort string
}
Config carries the selected strategies and the gateway host:port.
func (Config) CustomBackendURL ¶
CustomBackendURL parses OPENSEARCH_CUSTOM_BACKEND; a nil URL means unset.
func (Config) SharedOpenSearchCluster ¶
SharedOpenSearchCluster reports whether OPENSEARCH_MULTI_CLUSTER=false asks for one shared index store.
type Flags ¶
type Flags struct {
SQS string `` //nolint:lll // config struct tags are intentionally verbose
/* 174-byte string literal not displayed */
OpenSearch string `` //nolint:lll // config struct tags are intentionally verbose
/* 178-byte string literal not displayed */
GraphQL string `` //nolint:lll // config struct tags are intentionally verbose
/* 163-byte string literal not displayed */
// OpenSearchMultiCluster and OpenSearchCustomBackend are opt-in LocalStack-compatible options.
OpenSearchMultiCluster string `` //nolint:lll // config struct tags are intentionally verbose
/* 182-byte string literal not displayed */
OpenSearchCustomBackend string `` //nolint:lll // config struct tags are intentionally verbose
/* 191-byte string literal not displayed */
ECR string `` //nolint:lll // config struct tags are intentionally verbose
/* 150-byte string literal not displayed */
}
Flags are the user-selected strategies (CLI flags and LocalStack-compatible env vars).
type OpenSearchRequest ¶
type OpenSearchRequest struct {
Region string
Domain string
// Rest is the request path below the domain, starting with "/" or empty.
Rest string
}
OpenSearchRequest is a data-plane request addressed through a strategy endpoint.
func ParseOpenSearchRequest ¶
func ParseOpenSearchRequest(host, path string) (OpenSearchRequest, bool)
ParseOpenSearchRequest recognises <domain>.<region>.<engine>.localhost.localstack.cloud hosts and /<engine>/<region>/<domain>/... paths.