dynatrace_client

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OsWindows = "windows"
	OsUnix    = "unix"
	OsAix     = "aix"
	OsSolaris = "solaris"
)

Known OS values.

View Source
const (
	InstallerTypeDefault    = "default"
	InstallerTypeUnattended = "default-unattended"
	InstallerTypePaasZip    = "paas"
	InstallerTypePaasSh     = "paas-sh"
)

Known installer types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetVersionForLatest gets the latest agent version for the given OS and installer type.
	// Returns the version as received from the server on success.
	//
	// Returns an error for the following conditions:
	//  - os or installerType is empty
	//  - IO error or unexpected response
	//  - error response from the server (e.g. authentication failure)
	//  - the agent version is not set or empty
	GetVersionForLatest(os, installerType string) (string, error)

	// GetVersionForIp returns the agent version running on the host with the given IP address.
	// Returns the version string formatted as "Major.Minor.Revision.Timestamp" on success.
	//
	// Returns an error for the following conditions:
	//  - the IP is empty
	//  - IO error or unexpected response
	//  - error response from the server (e.g. authentication failure)
	//  - a host with the given IP cannot be found
	//  - the agent version for the host is not set
	//
	// The list of all hosts with their IP addresses is cached the first time this method is called. Use a new
	// client instance to fetch a new list from the server.
	GetVersionForIp(ip string) (string, error)

	// GetCommunicationHosts returns, on success, the list of communication hosts used for available
	// communication endpoints that the Dynatrace OneAgent can use to connect to.
	//
	// Returns an error if there was also an error response from the server.
	GetCommunicationHosts() ([]CommunicationHost, error)

	// GetAPIURLHost returns a CommunicationHost for the client's API URL. Or error, if failed to be parsed.
	GetAPIURLHost() (CommunicationHost, error)
}

Client is the interface for the Dynatrace REST API client.

func NewClient

func NewClient(url, apiToken, paasToken string, opts ...Option) (Client, error)

NewClient creates a REST client for the given API base URL and authentication tokens. Returns an error if a token or the URL is empty.

The API base URL is different for managed and SaaS environments:

  • SaaS: https://{environment-id}.live.dynatrace.com/api
  • Managed: https://{domain}/e/{environment-id}/api

opts can be used to customize the created client, entries must not be nil.

type CommunicationHost added in v0.4.0

type CommunicationHost struct {
	Protocol string
	Host     string
	Port     uint32
}

CommunicationHost represents a host used in a communication endpoint.

type Option

type Option func(*client)

Option can be passed to NewClient and customizes the created client instance.

func SkipCertificateValidation

func SkipCertificateValidation(skip bool) Option

SkipCertificateValidation creates an Option that specifies whether validation of the server's TLS certificate should be skipped. The default is false.

Jump to

Keyboard shortcuts

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