Documentation ¶
Index ¶
- Constants
- type ActiveGateAuthTokenInfo
- type ActiveGateAuthTokenParams
- type ActiveGateConnectionInfo
- type Client
- type CommunicationHost
- type ConfMap
- type ConnectionInfo
- type EventData
- type EventDataAttachRules
- type GetSettingsResponse
- type HostNotFoundErr
- type LatestImageInfo
- type MonitoredEntity
- type MonitoringSettings
- type OneAgentConnectionInfo
- type Option
- type ProcessModuleConfig
- func (pmc *ProcessModuleConfig) Add(newProperty ProcessModuleProperty) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddConnectionInfo(oneAgentConnectionInfo dynatracev1beta1.OneAgentConnectionInfoStatus, ...) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddHostGroup(hostGroup string) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddNoProxy(noProxy string) *ProcessModuleConfig
- func (pmc *ProcessModuleConfig) AddProxy(proxy string) *ProcessModuleConfig
- func (pmc ProcessModuleConfig) IsEmpty() bool
- func (pmc ProcessModuleConfig) ToMap() ConfMap
- type ProcessModuleProperty
- type ServerError
- type TokenScopes
Constants ¶
const ( PaasToken = "paasToken" ApiToken = "apiToken" DataIngestToken = "dataIngestToken" )
const ( InstallerTypeDefault = "default" InstallerTypePaaS = "paas" )
Relevant installer types.
const ( TokenScopeInstallerDownload = "InstallerDownload" TokenScopeDataExport = "DataExport" TokenScopeMetricsIngest = "metrics.ingest" TokenScopeEntitiesRead = "entities.read" TokenScopeSettingsRead = "settings.read" TokenScopeSettingsWrite = "settings.write" TokenScopeActiveGateTokenCreate = "activeGateTokenManagement.create" )
Relevant token scopes
const ( SettingsSchemaId = "builtin:cloud.kubernetes" AppTransitionSchemaId = "builtin:app-transition.kubernetes" )
const ApiTokenHeader = "Api-Token "
const (
MarkedForTerminationEvent = "MARKED_FOR_TERMINATION"
)
const (
OsUnix = "unix"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveGateAuthTokenInfo ¶
type ActiveGateConnectionInfo ¶
type ActiveGateConnectionInfo struct {
ConnectionInfo
}
type Client ¶
type Client interface { // GetLatestAgentVersion 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 GetLatestAgentVersion(ctx context.Context, os, installerType string) (string, error) // GetLatestAgent returns a reader with the contents of the download. Must be closed by caller. GetLatestAgent(ctx context.Context, os, installerType, flavor, arch string, technologies []string, skipMetadata bool, writer io.Writer) error // GetAgent downloads a specific agent version and writes it to the given io.Writer GetAgent(ctx context.Context, os, installerType, flavor, arch, version string, technologies []string, skipMetadata bool, writer io.Writer) error // GetAgentViaInstallerUrl downloads the agent from the user specified URL and writes it to the given io.Writer GetAgentViaInstallerUrl(ctx context.Context, url string, writer io.Writer) error // GetAgentVersions on success returns an array of versions that can be used with GetAgent to // download a specific agent version GetAgentVersions(ctx context.Context, os, installerType, flavor, arch string) ([]string, error) GetOneAgentConnectionInfo(ctx context.Context) (OneAgentConnectionInfo, error) GetProcessModuleConfig(ctx context.Context, prevRevision uint) (*ProcessModuleConfig, error) // GetCommunicationHostForClient returns a CommunicationHost for the client's API URL. Or error, if failed to be parsed. GetCommunicationHostForClient() (CommunicationHost, error) // SendEvent posts events to dynatrace API SendEvent(ctx context.Context, eventData *EventData) error // GetEntityIDForIP returns the entity id for a given IP address. // Returns an error in case the lookup failed. GetEntityIDForIP(ctx context.Context, ip string) (string, error) // GetTokenScopes returns the list of scopes assigned to a token if successful. GetTokenScopes(ctx context.Context, token string) (TokenScopes, error) // GetActiveGateConnectionInfo returns AgentTenantInfo for ActiveGate that holds UUID, Tenant Token and Endpoints GetActiveGateConnectionInfo(ctx context.Context) (ActiveGateConnectionInfo, error) // CreateOrUpdateKubernetesSetting returns the object id of the created k8s settings if successful, or an api error otherwise CreateOrUpdateKubernetesSetting(ctx context.Context, name, kubeSystemUUID, scope string) (string, error) // CreateOrUpdateKubernetesAppSetting returns the object id of the created k8s app settings if successful, or an api error otherwise CreateOrUpdateKubernetesAppSetting(ctx context.Context, scope string) (string, error) // GetMonitoredEntitiesForKubeSystemUUID returns a (possibly empty) list of k8s monitored entities for the given uuid, // or an api error otherwise GetMonitoredEntitiesForKubeSystemUUID(ctx context.Context, kubeSystemUUID string) ([]MonitoredEntity, error) // GetSettingsForMonitoredEntities returns the settings response with the number of settings objects, // or an api error otherwise GetSettingsForMonitoredEntities(ctx context.Context, monitoredEntities []MonitoredEntity, schemaId string) (GetSettingsResponse, error) GetActiveGateAuthToken(ctx context.Context, dynakubeName string) (*ActiveGateAuthTokenInfo, error) GetLatestOneAgentImage(ctx context.Context) (*LatestImageInfo, error) GetLatestCodeModulesImage(ctx context.Context) (*LatestImageInfo, error) GetLatestActiveGateImage(ctx context.Context) (*LatestImageInfo, error) // GetLatestActiveGateVersion gets the latest gateway version for the given OS and arch. // Returns the version as received from the server on success. GetLatestActiveGateVersion(ctx context.Context, os string) (string, error) }
Client is the interface for the Dynatrace REST API client.
func NewClient ¶
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 ¶
CommunicationHost => struct of connection endpoint
func ParseEndpoint ¶
func ParseEndpoint(s string) (CommunicationHost, error)
type ConfMap ¶
ConfMap is the representation of a config file with sections that are divided by headers (map[header] == section) each section consists of key value pairs.
type ConnectionInfo ¶
type EventData ¶
type EventData struct { EventType string `json:"eventType"` Description string `json:"description"` Source string `json:"source"` AttachRules EventDataAttachRules `json:"attachRules"` StartInMillis uint64 `json:"start"` EndInMillis uint64 `json:"end"` }
EventData struct which defines what event payload should contain
type EventDataAttachRules ¶
type EventDataAttachRules struct {
EntityIDs []string `json:"entityIds"`
}
type GetSettingsResponse ¶
type GetSettingsResponse struct {
TotalCount int `json:"totalCount"`
}
type HostNotFoundErr ¶
type HostNotFoundErr struct {
IP string
}
func (HostNotFoundErr) Error ¶
func (e HostNotFoundErr) Error() string
type LatestImageInfo ¶
func (LatestImageInfo) String ¶
func (image LatestImageInfo) String() string
type MonitoredEntity ¶
type MonitoringSettings ¶
type MonitoringSettings struct { CloudApplicationPipelineEnabled bool `json:"cloudApplicationPipelineEnabled"` OpenMetricsPipelineEnabled bool `json:"openMetricsPipelineEnabled"` EventProcessingActive bool `json:"eventProcessingActive"` EventProcessingV2Active bool `json:"eventProcessingV2Active"` FilterEvents bool `json:"filterEvents"` }
type OneAgentConnectionInfo ¶
type OneAgentConnectionInfo struct { ConnectionInfo CommunicationHosts []CommunicationHost }
type Option ¶
type Option func(*dynatraceClient)
Option can be passed to NewClient and customizes the created client instance.
func NetworkZone ¶
func SkipCertificateValidation ¶
SkipCertificateValidation creates an Option that specifies whether validation of the server's TLS certificate should be skipped. The default is false.
type ProcessModuleConfig ¶
type ProcessModuleConfig struct { Properties []ProcessModuleProperty `json:"properties"` Revision uint `json:"revision"` }
func (*ProcessModuleConfig) Add ¶
func (pmc *ProcessModuleConfig) Add(newProperty ProcessModuleProperty) *ProcessModuleConfig
func (*ProcessModuleConfig) AddConnectionInfo ¶
func (pmc *ProcessModuleConfig) AddConnectionInfo(oneAgentConnectionInfo dynatracev1beta1.OneAgentConnectionInfoStatus, tenantToken string) *ProcessModuleConfig
func (*ProcessModuleConfig) AddHostGroup ¶
func (pmc *ProcessModuleConfig) AddHostGroup(hostGroup string) *ProcessModuleConfig
func (*ProcessModuleConfig) AddNoProxy ¶ added in v1.0.0
func (pmc *ProcessModuleConfig) AddNoProxy(noProxy string) *ProcessModuleConfig
func (*ProcessModuleConfig) AddProxy ¶
func (pmc *ProcessModuleConfig) AddProxy(proxy string) *ProcessModuleConfig
func (ProcessModuleConfig) IsEmpty ¶
func (pmc ProcessModuleConfig) IsEmpty() bool
func (ProcessModuleConfig) ToMap ¶
func (pmc ProcessModuleConfig) ToMap() ConfMap
type ProcessModuleProperty ¶
type ServerError ¶
ServerError represents an error returned from the server (e.g. authentication failure).
func (ServerError) Error ¶
func (e ServerError) Error() string
Error formats the server error code and message.
type TokenScopes ¶
type TokenScopes []string
TokenScopes is a list of scopes assigned to a token
func (TokenScopes) Contains ¶
func (s TokenScopes) Contains(scope string) bool
Contains returns true if scope is included on the scopes, or false otherwise.