endpoints

package
v0.0.0-...-dd20015 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	EndpointCacheExpireTime = 3600 //Seconds
)
View Source
const (
	ResolveEndpointUserGuideLink = ""
)

Variables

This section is empty.

Functions

func AddEndpointMapping

func AddEndpointMapping(regionId, productId, endpoint string) (err error)

AddEndpointMapping Use product id and region id as key to store the endpoint into inner map

func CheckCacheIsExpire

func CheckCacheIsExpire(cacheKey string) bool

func Resolve

func Resolve(param *ResolveParam) (endpoint string, err error)

Resolve resolve endpoint with params It will resolve with each supported resolver until anyone resolved

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Cache) Get

func (c *Cache) Get(k string) (v interface{})

func (*Cache) Set

func (c *Cache) Set(k string, v interface{})

type EndpointObj

type EndpointObj struct {
	// Protocols   map[string]string
	Type        string
	Namespace   string
	Id          string
	SerivceCode string
	Endpoint    string
}

type EndpointsObj

type EndpointsObj struct {
	Endpoint []EndpointObj
}

type GetEndpointResponse

type GetEndpointResponse struct {
	Endpoints *EndpointsObj
	RequestId string
	Success   bool
}

type LocalGlobalResolver

type LocalGlobalResolver struct {
}

func (*LocalGlobalResolver) GetName

func (resolver *LocalGlobalResolver) GetName() (name string)

func (*LocalGlobalResolver) TryResolve

func (resolver *LocalGlobalResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error)

type LocalRegionalResolver

type LocalRegionalResolver struct {
}

func (*LocalRegionalResolver) GetName

func (resolver *LocalRegionalResolver) GetName() (name string)

func (*LocalRegionalResolver) TryResolve

func (resolver *LocalRegionalResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error)

type LocationResolver

type LocationResolver struct {
}

func (*LocationResolver) GetName

func (resolver *LocationResolver) GetName() (name string)

func (*LocationResolver) TryResolve

func (resolver *LocationResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error)

type MappingResolver

type MappingResolver struct {
}

MappingResolver the mapping resolver type

func (*MappingResolver) GetName

func (resolver *MappingResolver) GetName() (name string)

GetName get the resolver name: "mapping resolver"

func (*MappingResolver) TryResolve

func (resolver *MappingResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error)

TryResolve use Product and RegionId as key to find endpoint from inner map

type ResolveParam

type ResolveParam struct {
	Domain               string
	Product              string
	RegionId             string
	LocationProduct      string
	LocationEndpointType string
	CommonApi            func(request *requests.CommonRequest) (response *responses.CommonResponse, err error) `json:"-"`
}

func (*ResolveParam) String

func (param *ResolveParam) String() string

type Resolver

type Resolver interface {
	TryResolve(param *ResolveParam) (endpoint string, support bool, err error)
	GetName() (name string)
}

type SimpleHostResolver

type SimpleHostResolver struct {
}

SimpleHostResolver the simple host resolver type

func (*SimpleHostResolver) GetName

func (resolver *SimpleHostResolver) GetName() (name string)

GetName get the resolver name: "simple host resolver"

func (*SimpleHostResolver) TryResolve

func (resolver *SimpleHostResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error)

TryResolve if the Domain exist in param, use it as endpoint

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL