Documentation
¶
Index ¶
- Constants
- Variables
- type AmazonMetadata
- type App
- type AppsResponse
- type Client
- func (c *Client) App(appName string) (*App, error)
- func (c *Client) AppInstance(appName, instanceID string) (*Instance, error)
- func (c *Client) Apps() ([]*App, error)
- func (c *Client) Deregister(instance *Instance) error
- func (c *Client) Heartbeat(instance *Instance) error
- func (c *Client) Instance(instanceID string) (*Instance, error)
- func (c *Client) Register(instance *Instance) error
- func (c *Client) RemoveStatusOverride(instance *Instance, fallback Status) error
- func (c *Client) StatusOverride(instance *Instance, status Status) error
- func (c *Client) Watch(pollInterval time.Duration) *Watcher
- type DataCenter
- type DataCenterType
- type Duration
- type Event
- type EventType
- type Instance
- type Lease
- type Metadata
- type Option
- func HTTPTimeout(t time.Duration) Option
- func HTTPTransport(t *http.Transport) Option
- func Oauth2ClientCredentials(clientID, clientSecret, tokenURI string, scopes ...string) Option
- func RetryDelay(delay retry.Delay) Option
- func RetryLimit(limit retry.Allow) Option
- func RetrySelector(selector retry.Selector) Option
- func TLSConfig(config *tls.Config) Option
- type Port
- type Registry
- type Status
- type Time
- type Watcher
Constants ¶
const DefaultPollInterval = 30 * time.Second
DefaultPollInterval defines the default interval at which the watcher queries the registry.
Variables ¶
var ( // DefaultRetrySelector defines the default selector to be used when selecting // endpoints for request retries. DefaultRetrySelector retry.Selector = retry.RoundRobin // DefaultRetryLimit defines the default allowance for request retries. DefaultRetryLimit retry.Allow = retry.MaxRetries(3) // DefaultRetryDelay defines the default delay in-between request retries. DefaultRetryDelay retry.Delay = retry.ConstantDelay(1 * time.Second) // DefaultTransport defines the default roundtripper used by the internal http client. DefaultTransport = &http.Transport{ Dial: (&net.Dialer{ Timeout: 5 * time.Second, KeepAlive: 60 * time.Second, }).Dial, TLSHandshakeTimeout: 5 * time.Second, ResponseHeaderTimeout: 5 * time.Second, ExpectContinueTimeout: 1 * time.Second, MaxIdleConnsPerHost: 1, } // DefaultTimeout defines the default timeout used by the internal http client. DefaultTimeout = 10 * time.Second )
Functions ¶
This section is empty.
Types ¶
type AmazonMetadata ¶
type AmazonMetadata struct {
HostName string `xml:"hostname"`
PublicHostName string `xml:"public-hostname"`
LocalHostName string `xml:"local-hostname"`
PublicIPV4 string `xml:"public-ipv4"`
LocalIPV4 string `xml:"local-ipv4"`
AvailabilityZone string `xml:"availability-zone"`
InstanceID string `xml:"instance-id"`
InstanceType string `xml:"instance-type"`
AmiID string `xml:"ami-id"`
AmiLaunchIndex string `xml:"ami-launch-index"`
AmiManifestPath string `xml:"ami-manifest-path"`
}
type AppsResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AppInstance ¶
func (*Client) Deregister ¶
func (*Client) RemoveStatusOverride ¶
func (*Client) StatusOverride ¶
type DataCenter ¶
type DataCenter struct {
Type DataCenterType `xml:"name"`
Metadata AmazonMetadata `xml:"metadata"`
}
type DataCenterType ¶
type DataCenterType uint8
const ( DataCenterTypePrivate DataCenterType = iota DataCenterTypeAmazon )
func (DataCenterType) MarshalXML ¶
func (dct DataCenterType) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*DataCenterType) UnmarshalXML ¶
func (dct *DataCenterType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type EventType ¶
type EventType uint8
EventType defines the type of an observed event.
const ( // EventInstanceRegistered indicates that a newly registered instance has // been observed. EventInstanceRegistered EventType = iota // EventInstanceDeregistered indicates that a previously registered instance // is no longer registered. EventInstanceDeregistered // EventInstanceUpdated indicates that a previously registered instance has // changed in the registry, e.g. status or metadata changes have been observed. EventInstanceUpdated )
type Instance ¶
type Instance struct {
XMLName xml.Name `xml:"instance"`
ID string `xml:"instanceId"`
HostName string `xml:"hostName"`
AppName string `xml:"app"`
IPAddr string `xml:"ipAddr"`
VIPAddr string `xml:"vipAddress"`
SecureVIPAddr string `xml:"secureVipAddress"`
Status Status `xml:"status"`
StatusOverride Status `xml:"overriddenstatus"`
Port Port `xml:"port"`
SecurePort Port `xml:"securePort"`
HomePageURL string `xml:"homePageUrl"`
StatusPageURL string `xml:"statusPageUrl"`
HealthCheckURL string `xml:"healthCheckUrl"`
DataCenterInfo DataCenter `xml:"dataCenterInfo"`
LeaseInfo Lease `xml:"leaseInfo"`
Metadata Metadata `xml:"metadata"`
}
type Lease ¶
type Lease struct {
RenewalInterval Duration `xml:"renewalIntervalInSecs"`
Duration Duration `xml:"durationInSecs"`
RegistrationTime Time `xml:"registrationTimestamp"`
LastRenewalTime Time `xml:"lastRenewalTimestamp"`
EvictionTime Time `xml:"evictionTimestamp"`
ServiceUpTime Time `xml:"serviceUpTimestamp"`
}
type Option ¶
type Option func(*Client)
Option can be used to configure a Client.
func HTTPTimeout ¶
HTTPTimeout sets the timeout for the internal HTTP client.
func HTTPTransport ¶
HTTPTransport sets the transport for the internal HTTP client.
func Oauth2ClientCredentials ¶
Oauth2ClientCredentials instructs the internal http client to use the Oauth2 Client Credential flow to authenticate with the Eureka server.
func RetryDelay ¶
RetryDelay sets the delau the client in-between request retries.
func RetryLimit ¶
RetryLimit instructs the client to limit retries to a given allowance.
func RetrySelector ¶
RetrySelector instructs the client to use a given selector to pick endpoints for retries.
type Status ¶
type Status uint8
func ParseStatus ¶
func (Status) MarshalXML ¶
func (*Status) UnmarshalXML ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher can be used to observe the registry for changes with respect to the instances of particular app.