rest

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MinimumDynatraceVersionReached added in v1.7.0

func MinimumDynatraceVersionReached(expectedMinVersion Version, currentVersion Version) bool

func Wait

func Wait(description string, maxPollCount int, condition func() bool) error

Types

type ApiVersionObject added in v1.7.0

type ApiVersionObject struct {
	Version string `json:"version"`
}

type DynatraceClient added in v1.1.0

type DynatraceClient interface {

	// List lists the available configs for an API.
	// It calls the underlying GET endpoint of the API. E.g. for alerting profiles this would be:
	//    GET <environment-url>/api/config/v1/alertingProfiles
	// The result is expressed using a list of Value (id and name tuples).
	List(a Api) (values []Value, err error)

	// ReadByName reads a Dynatrace config identified by name from the given API.
	// It calls the underlying GET endpoints for the API. E.g. for alerting profiles this would be:
	//    GET <environment-url>/api/config/v1/alertingProfiles ... to get the id of the existing alerting profile
	//    GET <environment-url>/api/config/v1/alertingProfiles/<id> ... to get the alerting profile
	ReadByName(a Api, name string) (json []byte, err error)

	// ReadById reads a Dynatrace config identified by id from the given API.
	// It calls the underlying GET endpoint for the API. E.g. for alerting profiles this would be:
	//    GET <environment-url>/api/config/v1/alertingProfiles/<id> ... to get the alerting profile
	ReadById(a Api, name string) (json []byte, err error)

	// Upsert creates a given Dynatrace config it it doesn't exists and updates it otherwise using its name
	// It calls the underlying GET, POST, and PUT endpoints for the API. E.g. for alerting profiles this would be:
	//    GET <environment-url>/api/config/v1/alertingProfiles ... to check if the config is already available
	//    POST <environment-url>/api/config/v1/alertingProfiles ... afterwards, if the config is not yet available
	//    PUT <environment-url>/api/config/v1/alertingProfiles/<id> ... instead of POST, if the config is already available
	UpsertByName(a Api, name string, payload []byte) (entity DynatraceEntity, err error)

	// UpsertByEntityId creates or updates an existing Dynatrace entity by it's id.
	// If the entity doesn't exist it is created with the according id. E.g. for alerting profiles this would be:
	//    PUT <environment-url>/api/config/v1/alertingProfiles/<id> ... whether or not the config is already available
	UpsertByEntityId(a Api, entityId string, name string, payload []byte) (entity DynatraceEntity, err error)

	// Delete removes a given config for a given API using its name.
	// It calls the underlying GET and DELETE endpoints for the API. E.g. for alerting profiles this would be:
	//    GET <environment-url>/api/config/v1/alertingProfiles ... to get the id of the existing config
	//    DELETE <environment-url>/api/config/v1/alertingProfiles/<id> ... to delete the config
	DeleteByName(a Api, name string) error

	// ExistsByName checks if a config with the given name exists for the given API.
	// It calls the underlying GET endpoint for the API. E.g. for alerting profiles this would be:
	//    GET <environment-url>/api/config/v1/alertingProfiles
	ExistsByName(a Api, name string) (exists bool, id string, err error)
}

DynatraceClient provides the functionality for performing basic CRUD operations on any Dynatrace API supported by monaco. It encapsulates the configuration-specific inconsistencies of certain APIs in one place to provide a common interface to work with. After all: A user of DynatraceClient shouldn't care about the implementation details of each individual Dynatrace API. Its design is intentionally not dependant on the Config and Environment interfaces included in monaco. This makes sure, that DynatraceClient can be used as a base for future tooling, which relies on a standardized way to access Dynatrace APIs.

func NewDynatraceClient added in v1.1.0

func NewDynatraceClient(environmentUrl, token string) (DynatraceClient, error)

NewDynatraceClient creates a new DynatraceClient

type Response

type Response struct {
	StatusCode int
	Body       []byte
	Headers    map[string][]string
}

type Version added in v1.7.0

type Version struct {
	Major int
	Minor int
	Patch int
}

func GetDynatraceVersion added in v1.7.0

func GetDynatraceVersion(client *http.Client, environmentUrl string, apiToken string) (Version, error)

func (*Version) String added in v1.7.0

func (v *Version) String() string

Jump to

Keyboard shortcuts

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