Documentation ¶
Index ¶
- func CreateService(sd *cloudmap.CloudMap, name string, namespaceId string, ...) (serviceId string, err error)
- func DeregisterInstance(sd *cloudmap.CloudMap, instanceId string, serviceId string, ...) (operationId string, err error)
- func DiscoverApiIps(sd *cloudmap.CloudMap, serviceName string, namespaceName string, ...) (ipList []string, err error)
- func DiscoverDnsIps(hostName string, srv bool) (ipList []string, err error)
- func GetOperationStatus(sd *cloudmap.CloudMap, operationId string, timeoutDuration ...time.Duration) (status sdoperationstatus.SdOperationStatus, err error)
- func RegisterInstance(sd *cloudmap.CloudMap, serviceId string, instancePrefix string, ip string, ...) (instanceId string, operationId string, err error)
- func UpdateHealthStatus(sd *cloudmap.CloudMap, instanceId string, serviceId string, healthy bool, ...) error
- type InstanceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateService ¶
func CreateService(sd *cloudmap.CloudMap, name string, namespaceId string, dnsConf *cloudmap.DnsConf, healthCheckConf *cloudmap.HealthCheckConf, description string, timeoutDuration ...time.Duration) (serviceId string, err error)
CreateService will create a service under given namespaceId that was already created in cloud map
name = (required) name of the service to create, under the given namespaceId namespaceId = (required) namespace that this service be created under dnsConf = (conditional) required for public and private dns namespaces, configures the dns parameters for this service healthCheckConf = (optional) nil will not set health check, otherwise sets a health check condition for this services' instances description = (optional) public dns namespace description timeOutDuration = (optional) maximum time before timeout via context
func DeregisterInstance ¶
func DeregisterInstance(sd *cloudmap.CloudMap, instanceId string, serviceId string, timeoutDuration ...time.Duration) (operationId string, err error)
DeregisterInstance will remove the given instance from cloudmap and route 53 use the operationId with GetOperationStatus to check on progress
func DiscoverApiIps ¶
func DiscoverApiIps(sd *cloudmap.CloudMap, serviceName string, namespaceName string, version string, maxResult *int64) (ipList []string, err error)
DiscoverApiIps will use cloud map api to query a given service and namespace associated healthy ip addresses, up to 100 is returned if maxResult is not set, this call can be used outside of vpc for private dns namespaces, this call returns ip address : port (support for dynamic service ports when registered)
func DiscoverDnsIps ¶
DiscoverDnsIps will use dns to query a given hostname's associated ip addresses or srv hosts, if hostname is in public dns under route 53, then this action will work from outside of aws vpc if hostname is in private dns under route 53, then this action will work ONLY from within aws vpc that matches to this hostname's namespace vpc
hostName = (required) host name to lookup via dns srv = (required) true: lookup via srv and return srv host and port; false: lookup via A and return ip only
func GetOperationStatus ¶
func GetOperationStatus(sd *cloudmap.CloudMap, operationId string, timeoutDuration ...time.Duration) (status sdoperationstatus.SdOperationStatus, err error)
GetOperationStatus will check if a given operationId was successfully completed
func RegisterInstance ¶
func RegisterInstance(sd *cloudmap.CloudMap, serviceId string, instancePrefix string, ip string, port uint, healthy bool, version string, timeoutDuration ...time.Duration) (instanceId string, operationId string, err error)
RegisterInstance will register a service endpoint to aws cloudmap use the operationId with GetOperationStatus to check on progress
sd = (required) cloudmap service discovery object serviceId = (required) cloudmap service id instancePrefix = (optional) such as hellosvc- or just leave as blank; guid will be appended the prefix ip = (required) ip address of the instance being registered port = (required) port number of the instance being registered healthy = (reequired) indicates the initial instance state as healthy or unhealthy when registered to cloudmap version = (optional) such as v1.0.1, semver semantic, for internal use by services
Types ¶
type InstanceInfo ¶
type InstanceInfo struct { ServiceId string ServiceName string NamespaceName string InstanceId string InstanceIP string InstancePort uint InstanceVersion string InstanceHealthy bool }
func DiscoverInstances ¶
func DiscoverInstances(sd *cloudmap.CloudMap, serviceName string, namespaceName string, healthy bool, customAttributes map[string]string, maxResults *int64, timeoutDuration ...time.Duration) (instanceList []*InstanceInfo, err error)
DiscoverInstances will query cloudmap for instances matching given criteria