{"id":20317512,"url":"https://github.com/dynatrace/dynatrace-configuration-as-code-core","last_synced_at":"2025-06-20T23:36:28.414Z","repository":{"id":191792897,"uuid":"668699019","full_name":"Dynatrace/dynatrace-configuration-as-code-core","owner":"Dynatrace","description":"Dynatrace Configuration as Code - Core provides libraries simplifying development of configuration as code tooling for Dynatrace.","archived":false,"fork":false,"pushed_at":"2025-06-17T06:41:10.000Z","size":847,"stargazers_count":5,"open_issues_count":2,"forks_count":5,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-06-17T07:34:46.121Z","etag":null,"topics":["configuration-as-code","dynatrace"],"latest_commit_sha":null,"homepage":"https://docs.dynatrace.com/docs/deliver/configuration-as-code","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dynatrace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-07-20T11:56:22.000Z","updated_at":"2025-06-13T07:53:55.000Z","dependencies_parsed_at":"2023-10-02T13:02:04.090Z","dependency_job_id":"510e1ef0-e354-45d6-8690-a656a732998d","html_url":"https://github.com/Dynatrace/dynatrace-configuration-as-code-core","commit_stats":null,"previous_names":["dynatrace/dynatrace-configuration-as-code-core"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/Dynatrace/dynatrace-configuration-as-code-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynatrace%2Fdynatrace-configuration-as-code-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynatrace%2Fdynatrace-configuration-as-code-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynatrace%2Fdynatrace-configuration-as-code-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynatrace%2Fdynatrace-configuration-as-code-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dynatrace","download_url":"https://codeload.github.com/Dynatrace/dynatrace-configuration-as-code-core/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dynatrace%2Fdynatrace-configuration-as-code-core/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261037142,"owners_count":23100933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration-as-code","dynatrace"],"created_at":"2024-11-14T18:32:52.572Z","updated_at":"2025-06-20T23:36:23.395Z","avatar_url":"https://github.com/Dynatrace.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dynatrace Configuration as Code - Core\n[![stability-wip](https://img.shields.io/badge/stability-wip-lightgrey.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#work-in-progress)\n\n**Dynatrace Configuration as Code Core** provides libraries simplifying development of configuration as code tooling for Dynatrace.\n\nℹ️ **DISCLAIMER:** This library is **not** meant to be a general purpose client library for Dynatrace but rather contains functionality that is\ntailored to simplify the development of Configuration as Code tools like Monaco, the Terraform Provider, and similar tools.\n\n## API Clients\n\nThe library provides different kinds of clients to interact with Dynatrace in two different packages:\n\n* **api/clients**: \"Basic\" clients that offers a one-to-one mapping to the Dynatrace API and do not contain any other special logic.\n* **clients**: \"Smarter\" clients that build upon the basic clients to offer additional logic and operations tailored to simplify configuration as code use cases.\n  * Each client provides a method set, usually supporting CRUD operations and an Upsert - which will create or update a configuration as needed.\n  However, the specific interface might differ between clients.\n  * Payloads to and from the APIs aren't interpreted in any particular way.\n  Thus, it's the user's responsibility to marshal/unmarshal payloads into/from Go structs.\n\n\n  | API Client          | Implemented |\n  |---------------------|-------------|\n  | Classic config APIs | ❌           |\n  | Settings 2.0        | ❌           |\n  | Automation          | ✅           |\n  | Grail buckets       | ✅           |\n  | Documents           | ✅           |\n  | OpenPipeline        | ✅           |\n  | Segments            | ✅           |\n  | SLO's               | ✅           |\n\n### Usage\n\nTo instantiate an API client, it's recommended to create an instance via the provided `clients.Factory()` function:\n\n```go\n// create the factory\nfactory := clients.Factory().\n\tWithEnvironmentURL(\"https://dt-environment.com\").\n\tWithOAuthCredentials(credentials)\n\n// request any client from the factory, e.g. bucket api client\nbucketClient, err := factory.BucketClient()\nif err != nil {\n\t// handle error\n}\n\n// perform operation\nresp, err := bucketClient.Get(context.TODO(), \"my bucket\")\nif err != nil {\n\t// handle error\n}\n\n// inspect response\nif !resp.IsSuccess() {\n\t// handle api error\n}\n\n// unmarshal payload\nbucketDefinition, err := api.DecodeJSON[BucketDefinition](resp.Response)\nif err != nil {\n\t// handle error\n}\n```\n\n### Logging\n\nThe library uses [logr](https://github.com/go-logr/logr), a simple logging interface for Go.\nHence, it can be used with a wide range of known logging libraries for Go.\nPer default, the library does not log anything. If you want to turn logging on you need to carry\na logger to each library method via its context argument.\n\nTo do this, use [logr.NewContext](https://pkg.go.dev/github.com/go-logr/logr#NewContext).\n\nFor example, if you wish to use [Logrus](https://github.com/sirupsen/logrus) for logging:\n\n```go\nctx := logr.NewContext(context.TODO(), logrusr.New(logrus.New()))\nresp, err := ctx.Get(ctx,\"...\")\n```\n\n### Tracking and logging HTTP requests/responses\nIf you want to keep track or just log all HTTP requests/responses happening as part of the execution of the clients, you can implement an `HTTPListener` and attach it to the client.\nAll you need to do is implement a custom callback function and pass the `HTTPListener` when constructing a client.\nThe underlying `rest.Client` will then call your callback function with information about each HTTP request or response.\n\nFor example, in order to just print out all HTTP requests that are happening under the hood you can do the following:\n\n```go\nrequestPrinter := \u0026rest.HTTPListener{Callback: func(r rest.RequestResponse) {\n\tif req, ok := r.IsRequest(); ok {\n\t\tfmt.Printf(\"There was an HTTP %s request to %s\\n\", req.Method, req.URL.String())\n\t}\n}}\n\nfactory := clients.Factory().WithEnvironmentURL(\"https://dt-environment.com\").\n\tWithOAuthCredentials(credentials).\n\tWithHTTPListener(requestPrinter)\n\n// request a client from the factory and use it\n```\n\n## Forms of Dynatrace Configuration as Code\n\n* [Dynatrace Configuration as Code CLI Monaco](https://github.com/dynatrace/dynatrace-configuration-as-code)\n* [Dynatrace Terraform provider](https://github.com/dynatrace-oss/terraform-provider-dynatrace)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdynatrace%2Fdynatrace-configuration-as-code-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdynatrace%2Fdynatrace-configuration-as-code-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdynatrace%2Fdynatrace-configuration-as-code-core/lists"}