sdk

package module
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

dtctl SDK

A shared Go module for building tools and integrations against the Dynatrace platform, extracted from dtctl.

Install

go get github.com/Dynatrace/dtctl/sdk@latest

Versioning

The SDK is tagged sdk/vX.Y.Z in lockstep with the dtctl CLI release it was cut from: dtctl vX.Y.Z and sdk/vX.Y.Z are the same commit. The two modules ship from one repository and are compiled against each other in CI, so aligning the numbers is what lets the CLI module declare a resolvable dependency on the SDK — and lets you pair a CLI version with the SDK that matches it.

Two consequences: a new SDK tag appears on every CLI release, including ones that change nothing under sdk/ (check CHANGELOG.md for what actually moved), and the version jumped from sdk/v0.2.0 straight to the CLI's line when this alignment was introduced.

What's in the SDK

Infrastructure
Package Description
sdk/httpclient HTTP client with retry, rate limiting, typed errors, pagination helpers
sdk/auth Token type detection (API token vs OAuth/Bearer)
sdk/urls Dynatrace environment URL validation and normalization
sdk/agentmode AI agent environment detection and structured JSON envelope
sdk/inventory Environment data-inventory discovery — capabilities present/absent/unknown with evidence, entity census, buckets — driven through a caller-supplied DQL Runner
API wrappers (sdk/api/)

Thin, typed Go clients for Dynatrace REST APIs. Each package covers one API surface with CRUD operations, pagination, and structured error handling.

Package API
api/analyzer Query analyzer (DQL validation)
api/appengine App Engine (functions)
api/bucket Grail bucket management
api/classicpipelinestranslate Classic pipeline translation
api/copilot Davis Copilot completions
api/document Documents (dashboards, notebooks) + trash
api/edgeconnect EdgeConnect management
api/extension Extensions 2.0 lifecycle
api/hub Dynatrace Hub items
api/iam Account-level IAM (groups, users, policies)
api/livedebugger Live debugger sessions
api/notification Notification/alerting configuration
api/platformtoken Account platform-token management
api/query DQL query execution
api/segment Data segments
api/serviceuser Account service-user management
api/settings Settings 2.0 objects
api/slo Service Level Objectives
api/workflow Workflow CRUD and execution

What goes into the SDK

  • Direct REST API wrappers. One package per Dynatrace API surface, exposing typed Go structs and CRUD functions that map 1:1 to API endpoints.
  • Shared infrastructure. HTTP client, auth, URL handling, credential storage -- anything two or more consumers would need.
  • No CLI concerns. No Cobra, no Viper, no terminal formatting, no interactive prompts.

What does NOT go into the SDK

  • Convenience wrappers that compose multiple APIs. If a function calls API A then API B (e.g. EnsureEnvironmentShare), it belongs in the CLI.
  • Display/formatting logic. Functions like populateDisplayFields, GetRaw, DQL-to-AST conversion, or anything that transforms data for human consumption.
  • Packages that wrap non-Dynatrace APIs or aggregate multiple API calls into a higher-level operation (e.g. anomalydetector, azureconnection, gcpconnection).
  • CLI-specific types. Structs with fields that only exist for display purposes (e.g. VariablesDisplay, computed summary fields).
  • Lookup/resolution helpers. Name-to-ID resolution, interactive disambiguation, resource resolvers.

Design principles

  • No global state. Everything is constructed explicitly.
  • No file I/O. The SDK never reads from files or stdin. Functions like ReadFileOrStdin and ParseInputFromFile belong in the CLI layer (pkg/resources/). SDK functions accept Go types, never file paths.
  • Minimal dependencies. No Cobra, Viper, logrus, or OpenTelemetry.
  • One-way dependency. CLI -> SDK, never SDK -> CLI.
  • Logging is injected. The SDK accepts a Logger interface; it never imports a logging library.
  • Errors are typed. Use errors.Is/errors.As reliably. API errors follow the format "API error (<code>): <message>".

Versioning

  • sdk/v0.x.y -- no stability promise during v0.
  • sdk/v1.0.0 -- once at least two consumer CLIs have adopted the module.

Documentation

Overview

Package sdk is the dt-cli-sdk — a shared library of Dynatrace CLI primitives.

It provides platform-level building blocks that multiple Dynatrace CLIs (dtctl, dtmgd, dtwiz, and others) can share instead of re-implementing:

  • urls: Dynatrace environment URL validation and correction
  • auth: Token type detection and classification
  • httpclient: HTTP client with retry, pagination, and typed errors
  • agentmode: AI agent detection and structured JSON envelope
  • inventory: environment data-inventory discovery (capability evidence, entity census, buckets) driven through a caller-supplied DQL runner

The SDK is designed to be leaf-shaped: it never imports from the CLI module, has minimal dependencies, and avoids global state.

See https://github.com/Dynatrace/dtctl/tree/main/sdk for details.

Index

Constants

View Source
const Version = "0.2.0"

Version is the current version of the dt-cli-sdk.

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package agentmode provides AI agent detection and structured JSON output.
Package agentmode provides AI agent detection and structured JSON output.
api
apispec
Package apispec discovers and projects the OpenAPI documents a Dynatrace environment publishes about itself.
Package apispec discovers and projects the OpenAPI documents a Dynatrace environment publishes about itself.
classicpipelinestranslate
Package classicpipelinestranslate is a thin, read-only SDK client for the OpenPipeline "classic pipelines translation" endpoint, which converts an existing Classic pipeline configuration into an OpenPipeline configuration pipeline (Settings shape).
Package classicpipelinestranslate is a thin, read-only SDK client for the OpenPipeline "classic pipelines translation" endpoint, which converts an existing Classic pipeline configuration into an OpenPipeline configuration pipeline (Settings shape).
dqlprocessorverify
Package dqlprocessorverify is a thin, read-only SDK client for the OpenPipeline DQL processor verify endpoint, which validates a DQL processor script against an optional configuration scope.
Package dqlprocessorverify is a thin, read-only SDK client for the OpenPipeline DQL processor verify endpoint, which validates a DQL processor script against an optional configuration scope.
hub
iam
matcherlqltodql
Package matcherlqltodql is a thin SDK client for the OpenPipeline LQL-to-DQL translation endpoint.
Package matcherlqltodql is a thin SDK client for the OpenPipeline LQL-to-DQL translation endpoint.
matcherverify
Package matcherverify is a thin, read-only SDK client for the OpenPipeline matcher verify endpoint, which validates a DQL matcher expression against an optional configuration scope and stage context.
Package matcherverify is a thin, read-only SDK client for the OpenPipeline matcher verify endpoint, which validates a DQL matcher expression against an optional configuration scope and stage context.
previewprocessor
Package previewprocessor is a thin SDK client for the OpenPipeline preview processor endpoint, which executes a processor definition against sample records and returns the matched/modified results.
Package previewprocessor is a thin SDK client for the OpenPipeline preview processor endpoint, which executes a processor definition against sample records and returns the matched/modified results.
query
Package query provides a typed client for the Dynatrace DQL Query API (/platform/storage/query/v1/).
Package query provides a typed client for the Dynatrace DQL Query API (/platform/storage/query/v1/).
schedulingrule
Package schedulingrule provides access to the Dynatrace Automation Scheduling Rules API.
Package schedulingrule provides access to the Dynatrace Automation Scheduling Rules API.
slo
workflow
Package workflow provides access to the Dynatrace Automation Workflow API.
Package workflow provides access to the Dynatrace Automation Workflow API.
Package auth provides Dynatrace token type detection and classification.
Package auth provides Dynatrace token type detection and classification.
Package httpclient provides an HTTP client for Dynatrace APIs.
Package httpclient provides an HTTP client for Dynatrace APIs.
internal
testutil
Package testutil provides SDK-internal test helpers.
Package testutil provides SDK-internal test helpers.
Package inventory probes a Dynatrace environment for what data actually exists there: which Grail data objects are fetchable, which buckets and entity types are present, which capabilities (spans, RUM, k8s, cloud integrations, …) are backed by live evidence — and which are absent, with the evidence cited.
Package inventory probes a Dynatrace environment for what data actually exists there: which Grail data objects are fetchable, which buckets and entity types are present, which capabilities (spans, RUM, k8s, cloud integrations, …) are backed by live evidence — and which are absent, with the evidence cited.
Package session is the dtctl session layer: everything a Dynatrace CLI tool needs to go from "the user's machine" to "an authenticated client for the right tenant".
Package session is the dtctl session layer: everything a Dynatrace CLI tool needs to go from "the user's machine" to "an authenticated client for the right tenant".
Package urls provides Dynatrace environment URL validation and correction.
Package urls provides Dynatrace environment URL validation and correction.

Jump to

Keyboard shortcuts

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