Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DataDog/cloudcraft-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

77 Commits

Repository files navigation

cloudcraft-go

Go Documentation Go Report Card

Cloudcraft diagram

Visualize your cloud architecture with Cloudcraft by Datadog, the best way to create smart AWS and Azure diagrams.

Cloudcraft supports both manual and programmatic diagramming, as well as automatic reverse engineering of existing cloud environments into beautiful system architecture diagrams.

This cloudcraft-go package provides an easy-to-use native Go SDK for interacting with the Cloudcraft API.

Use case examples:

  • Snapshot and visually compare your live AWS or Azure environment before and after a deployment, in your app or as part of your automated CI pipeline
  • Download an inventory of all your cloud resources from a linked account as JSON
  • Write a converter from a third party data format to Cloudcraft diagrams
  • Backup, export & import your Cloudcraft data
  • Programmatically create Cloudcraft diagrams

This SDK requires a Cloudcraft API key to use. A free trial of Cloudcraft Pro with API access is available.

Installation

To install cloudcraft-go, run:

go get github.com/DataDog/cloudcraft-go

Documentation

Please see the Go reference documentation.

Usage

In the below example the Cloudcraft API key is read from the CLOUDCRAFT_API_KEY environment variable. Alternatively, pass in the key to the Config struct directly.

package main
import (
	"context"
	"log"
	"os"
	"github.com/DataDog/cloudcraft-go"
)
func main() {
	key, ok := os.LookupEnv("CLOUDCRAFT_API_KEY")
	if !ok {
		log.Fatal("missing env var: CLOUDCRAFT_API_KEY")
	}
	// Create new Config to be initialize a Client.
	cfg := cloudcraft.NewConfig(key)
	// Create a new Client instance with the given Config.
	client, err := cloudcraft.NewClient(cfg)
	if err != nil {
		log.Fatal(err)
	}
	// List all blueprints in an account.
	blueprints, _, err := client.Blueprint.List(context.Background())
	if err != nil {
		log.Fatal(err)
	}
	// Print the name of each blueprint.
	for _, blueprint := range blueprints {
		log.Println(blueprint.Name)
	}
}

More examples can be found in the examples directory.

Contributing

Anyone can help make cloudcraft-go better. Check out the contribution guidelines for more information.


Released under the Apache-2.0 License.

AltStyle によって変換されたページ (->オリジナル) /