dtclient

package
v2.17.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRetrySettings = RetrySettings{
	Normal: RetrySetting{
		WaitTime:   time.Second,
		MaxRetries: 15,
	},
	Long: RetrySetting{
		WaitTime:   time.Second,
		MaxRetries: 30,
	},
	VeryLong: RetrySetting{
		WaitTime:   time.Second,
		MaxRetries: 60,
	},
}

Functions

func GetWithRetry added in v2.16.0

func GetWithRetry(ctx context.Context, c corerest.Client, endpoint string, requestOptions corerest.RequestOptions, settings RetrySetting) (resp *coreapi.Response, err error)

func SendWithRetry added in v2.16.0

func SendWithRetry(ctx context.Context, sendWithBody SendRequestWithBody, endpoint string, requestOptions corerest.RequestOptions, body []byte, setting RetrySetting) (*coreapi.Response, error)

SendWithRetry will retry to call sendWithBody for a given number of times, waiting a give duration between calls

func SendWithRetryWithInitialTry added in v2.16.0

func SendWithRetryWithInitialTry(ctx context.Context, sendWithBody SendRequestWithBody, endpoint string, requestOptions corerest.RequestOptions, body []byte, setting RetrySetting) (*coreapi.Response, error)

SendWithRetryWithInitialTry will try to call sendWithBody and if it didn't succeed call SendWithRetry

func WithAutoServerVersion

func WithAutoServerVersion() func(client *SettingsClient)

WithAutoServerVersion can be used to let the client automatically determine the Dynatrace server version during creation using newDynatraceClient. If the server version is already known WithServerVersion should be used. Do not use this with NewPlatformSettingsClient() as the client will not work and cause an error to be logged.

func WithCachingDisabled added in v2.6.0

func WithCachingDisabled(disabled bool) func(client *SettingsClient)

WithCachingDisabled allows disabling the client's builtin caching mechanism for schema constraints and settings objects. Disabling the caching is recommended in situations where configs are fetched immediately after their creation (e.g. in test scenarios).

func WithCachingDisabledForConfigClient added in v2.17.0

func WithCachingDisabledForConfigClient(disabled bool) func(client *ConfigClient)

WithCachingDisabledForConfigClient allows disabling the client's builtin caching mechanism for classic configs. Disabling the caching is recommended in situations where configs are fetched immediately after their creation (e.g. in test scenarios).

func WithExternalIDGenerator

func WithExternalIDGenerator(g idutils.ExternalIDGenerator) func(client *SettingsClient)

func WithRetrySettings

func WithRetrySettings(retrySettings RetrySettings) func(*SettingsClient)

WithRetrySettings sets the retry settings to be used by the DynatraceClient

func WithRetrySettingsForClassic added in v2.17.0

func WithRetrySettingsForClassic(retrySettings RetrySettings) func(*ConfigClient)

WithRetrySettings sets the retry settings to be used by the ConfigClient

func WithServerVersion

func WithServerVersion(serverVersion version.Version) func(client *SettingsClient)

WithServerVersion sets the Dynatrace version of the Dynatrace server/tenant the client will be interacting with

Types

type AddEntriesToResult added in v2.16.0

type AddEntriesToResult func(body []byte) (receivedEntries int, err error)

AddEntriesToResult is a function which should parse an API response body and append the returned entries to a result slice. Handling the parsing, any possible filtering and owning and filling the result list is left to the caller of ListPaginated, as it might differ notably between client implementations. The function MUST return the number of entries it has parsed from the received API payload body. This is used to validate that the final parsed number matches the reported total count of the API. This receivedEntries count is not necessarily equal to the number of entries added to the result slice, as filtering might exclude some entries that where received from the API.

type ConfigClient

type ConfigClient struct {
	// contains filtered or unexported fields
}

func NewClassicConfigClient added in v2.17.0

func NewClassicConfigClient(client *corerest.Client, opts ...func(dynatraceClient *ConfigClient)) (*ConfigClient, error)

func (*ConfigClient) Cache added in v2.17.0

func (d *ConfigClient) Cache(ctx context.Context, api api.API) error

func (*ConfigClient) Delete added in v2.17.0

func (d *ConfigClient) Delete(ctx context.Context, api api.API, id string) error

func (*ConfigClient) ExistsWithName added in v2.17.0

func (d *ConfigClient) ExistsWithName(ctx context.Context, api api.API, name string) (exists bool, id string, err error)

func (*ConfigClient) Get added in v2.17.0

func (d *ConfigClient) Get(ctx context.Context, api api.API, id string) (json []byte, err error)

func (*ConfigClient) List added in v2.17.0

func (d *ConfigClient) List(ctx context.Context, theApi api.API) ([]Value, error)

func (*ConfigClient) UpsertByName added in v2.17.0

func (d *ConfigClient) UpsertByName(ctx context.Context, a api.API, name string, payload []byte) (entity DynatraceEntity, err error)

func (*ConfigClient) UpsertByNonUniqueNameAndId added in v2.17.0

func (d *ConfigClient) UpsertByNonUniqueNameAndId(ctx context.Context, theApi api.API, entityId string, objectName string, payload []byte, duplicate bool) (entity DynatraceEntity, err error)

type DataEntry

type DataEntry struct {
	Name    string
	Id      string
	Owner   string
	Payload []byte
}

type DownloadSettingsObject

type DownloadSettingsObject struct {
	ExternalId       string                    `json:"externalId"`
	SchemaVersion    string                    `json:"schemaVersion"`
	SchemaId         string                    `json:"schemaId"`
	ObjectId         string                    `json:"objectId"`
	Scope            string                    `json:"scope"`
	Value            json.RawMessage           `json:"value"`
	ModificationInfo *SettingsModificationInfo `json:"modificationInfo"`
}

DownloadSettingsObject is the response type for the ListSettings operation

type DummyConfigClient added in v2.17.0

type DummyConfigClient struct {
	Fs               afero.Fs
	RequestOutputDir string
	// contains filtered or unexported fields
}

func (*DummyConfigClient) Cache added in v2.17.0

func (c *DummyConfigClient) Cache(ctx context.Context, a api.API) error

func (*DummyConfigClient) CreatedObjects added in v2.17.0

func (c *DummyConfigClient) CreatedObjects() int

func (*DummyConfigClient) Delete added in v2.17.0

func (c *DummyConfigClient) Delete(_ context.Context, a api.API, id string) error

func (*DummyConfigClient) ExistsWithName added in v2.17.0

func (c *DummyConfigClient) ExistsWithName(_ context.Context, a api.API, name string) (exists bool, id string, err error)

func (*DummyConfigClient) Get added in v2.17.0

func (c *DummyConfigClient) Get(_ context.Context, a api.API, id string) ([]byte, error)

func (*DummyConfigClient) GetEntries added in v2.17.0

func (c *DummyConfigClient) GetEntries(a api.API) ([]DataEntry, bool)

func (*DummyConfigClient) List added in v2.17.0

func (c *DummyConfigClient) List(_ context.Context, a api.API) (values []Value, err error)

func (*DummyConfigClient) UpsertByName added in v2.17.0

func (c *DummyConfigClient) UpsertByName(_ context.Context, a api.API, name string, data []byte) (entity DynatraceEntity, err error)

func (*DummyConfigClient) UpsertByNonUniqueNameAndId added in v2.17.0

func (c *DummyConfigClient) UpsertByNonUniqueNameAndId(_ context.Context, a api.API, entityId string, name string, data []byte, _ bool) (entity DynatraceEntity, err error)

type DummySettingsClient added in v2.17.0

type DummySettingsClient struct{}

func (*DummySettingsClient) Cache added in v2.17.0

func (*DummySettingsClient) Delete added in v2.17.0

func (*DummySettingsClient) Get added in v2.17.0

func (*DummySettingsClient) GetSchema added in v2.17.0

func (c *DummySettingsClient) GetSchema(_ context.Context, _ string) (schema Schema, err error)

func (*DummySettingsClient) List added in v2.17.0

func (*DummySettingsClient) ListSchemas added in v2.17.0

func (c *DummySettingsClient) ListSchemas(_ context.Context) (SchemaList, error)

func (*DummySettingsClient) Upsert added in v2.17.0

type DynatraceEntity

type DynatraceEntity struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type KeyUserActionsMobileResponse added in v2.10.1

type KeyUserActionsMobileResponse struct {
	KeyUserActions []struct {
		Name string `json:"name"`
	} `json:"keyUserActions"`
}

type ListSettingsFilter

type ListSettingsFilter func(DownloadSettingsObject) bool

ListSettingsFilter can be used to filter fetched settings objects with custom criteria, e.g. o.ExternalId == ""

type ListSettingsOptions

type ListSettingsOptions struct {
	// DiscardValue specifies whether the value field of the returned
	// settings object shall be included in the payload
	DiscardValue bool
	// ListSettingsFilter can be set to pre-filter the result given a special logic
	Filter ListSettingsFilter
}

ListSettingsOptions are additional options for the ListSettings method of the Settings client

type Properties

type Properties struct {
	Version *string `json:"version"`
}

type RetrySetting added in v2.16.0

type RetrySetting struct {
	WaitTime   time.Duration
	MaxRetries int
}

type RetrySettings added in v2.16.0

type RetrySettings struct {
	Normal   RetrySetting
	Long     RetrySetting
	VeryLong RetrySetting
}

type Schema added in v2.14.0

type Schema struct {
	SchemaId         string
	Ordered          bool
	UniqueProperties [][]string
}

type SchemaList

type SchemaList []struct {
	SchemaId string `json:"schemaId"`
	Ordered  bool   `json:"ordered"`
}

type SchemaListResponse

type SchemaListResponse struct {
	Items      SchemaList `json:"items"`
	TotalCount int        `json:"totalCount"`
}

SchemaListResponse is the response type returned by the ListSchemas operation

type SendRequestWithBody added in v2.16.0

type SendRequestWithBody func(ctx context.Context, endpoint string, body io.Reader, options corerest.RequestOptions) (*http.Response, error)

SendRequestWithBody is a function doing a PUT or POST HTTP request

type SettingsClient

type SettingsClient struct {
	// contains filtered or unexported fields
}

func NewClassicSettingsClient added in v2.17.0

func NewClassicSettingsClient(client *corerest.Client, opts ...func(dynatraceClient *SettingsClient)) (*SettingsClient, error)

NewClassicSettingsClient creates a new settings client to be used for classic environments.

func NewPlatformSettingsClient added in v2.17.0

func NewPlatformSettingsClient(client *corerest.Client, opts ...func(dynatraceClient *SettingsClient)) (*SettingsClient, error)

NewPlatformSettingsClient creates a new settings client to be used for platform enabled environments

func (*SettingsClient) Cache added in v2.17.0

func (d *SettingsClient) Cache(ctx context.Context, schemaID string) error

func (*SettingsClient) Delete added in v2.17.0

func (d *SettingsClient) Delete(ctx context.Context, objectID string) error

func (*SettingsClient) Get added in v2.17.0

func (d *SettingsClient) Get(ctx context.Context, objectId string) (res *DownloadSettingsObject, err error)

func (*SettingsClient) GetSchema added in v2.17.0

func (d *SettingsClient) GetSchema(ctx context.Context, schemaID string) (constraints Schema, err error)

func (*SettingsClient) List added in v2.17.0

func (d *SettingsClient) List(ctx context.Context, schemaId string, opts ListSettingsOptions) (res []DownloadSettingsObject, err error)

func (*SettingsClient) ListSchemas

func (d *SettingsClient) ListSchemas(ctx context.Context) (schemas SchemaList, err error)

func (*SettingsClient) Upsert added in v2.17.0

func (d *SettingsClient) Upsert(ctx context.Context, obj SettingsObject, upsertOptions UpsertSettingsOptions) (result DynatraceEntity, err error)

type SettingsModificationInfo

type SettingsModificationInfo struct {
	Deletable          bool          `json:"deletable"`
	Modifiable         bool          `json:"modifiable"`
	Movable            bool          `json:"movable"`
	ModifiablePaths    []interface{} `json:"modifiablePaths"`
	NonModifiablePaths []interface{} `json:"nonModifiablePaths"`
}

type SettingsObject

type SettingsObject struct {
	// Coordinate holds all the information for Monaco to identify a settings object
	Coordinate coordinate.Coordinate
	// SchemaId is the Dynatrace settings schema ID
	SchemaId,

	SchemaVersion,

	Scope string
	// Content is the rendered config for the given settings object
	Content []byte
	// OriginObjectId is the object id of the Settings object when it was downloaded from an environment
	OriginObjectId string
}

SettingsObject contains all the information necessary to create/update a settings object

type SyntheticEntity

type SyntheticEntity struct {
	EntityId string `json:"entityId"`
}

type SyntheticLocationResponse

type SyntheticLocationResponse struct {
	Locations []SyntheticValue `json:"locations"`
}

type SyntheticMonitorsResponse

type SyntheticMonitorsResponse struct {
	Monitors []SyntheticValue `json:"monitors"`
}

type SyntheticValue

type SyntheticValue struct {
	Name          string    `json:"name"`
	EntityId      string    `json:"entityId"`
	Type          string    `json:"type"`
	CloudPlatform *string   `json:"cloudPlatform"`
	Ips           *[]string `json:"ips"`
	Stage         *string   `json:"stage"`
	Enabled       *bool     `json:"enabled"`
}

type UpsertSettingsOptions added in v2.8.1

type UpsertSettingsOptions struct {
	OverrideRetry *RetrySetting
	InsertAfter   string
}

type UserActionAndSessionPropertyEntry added in v2.11.0

type UserActionAndSessionPropertyEntry struct {
	Key         string `json:"key"`
	DisplayName string `json:"displayName"`
}

type UserActionAndSessionPropertyResponse added in v2.11.0

type UserActionAndSessionPropertyResponse struct {
	SessionProperties    []UserActionAndSessionPropertyEntry `json:"sessionProperties"`
	UserActionProperties []UserActionAndSessionPropertyEntry `json:"userActionProperties"`
}

type Value

type Value struct {
	Id   string `json:"id"`
	Name string `json:"name"`

	// Owner is used by dashboards to indicate the creator of the dashboard. We use it to filter Dynatrace created dashboards.
	Owner *string `json:"owner,omitempty"`

	// Type is used by synthetic-locations to indicate whether it is a PRIVATE location or not.
	Type *string `json:"type,omitempty"`

	// CustomFields holds additional fields. Note that this is not set automatically but would need to be populated
	// when unmarshalling the payload
	CustomFields map[string]any `json:"-"`
}

type ValuesResponse

type ValuesResponse struct {
	Values []Value `json:"values"`
}

Jump to

Keyboard shortcuts

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