GET
/azure/account/{account_id}/{region}/{format}
Overview
Scan and render one region of an Azure account into a blueprint in JSON, SVG, PNG, PDF, or MxGraph format.
The time required to generate the snapshot depends on the number of resources in the Azure region.
The API behaves as a long poll, with a wait time of up to 120 seconds for the result. For most
environments, the API call returns a blueprint. If
the wait time is exceeded, a 202 Accepted
response is returned with a
{code: STILL_PROCESSING, retry: true ...}
JSON body. The snapshot will continue processing in the background, and a retry will either immediately return the result or continue waiting.
Path Parameters
- account_id: UUID. Azure Account ID as registered with Cloudcraft.
- region: String. Azure region, for example, “eastus”.
- format: String. One of “json”, “svg”, “png”, “pdf”, or “mxGraph”.
Optional query parameters
- filter: String. Render a subset of the Azure account. Accepts a filter expression as used on the Live tab in the web application. The filter expression terms must be separated by spaces. The terms are substrings to be matched, key-value pairs, logical operators, or parentheses. For example, `env=dev OR env=test`.
- exclude: List of Strings. Exclude Azure services by name. For example, “azurevmss,azurensg” to exclude both Virtual Machine Scale Set and Network Security Groups. The service value is specified by the “type” field of Blueprint components.
- label: Boolean. Automatically label all components. Defaults to true.
- autoconnect: Boolean. Automatically connect all components. Defaults to true.
- scale: Float. Scale relative to original size (1.0), for example, 0.5 for half or 2.0 for double size.
- width: Number. Image width in pixels (for SVG, PNG, and PDF).
- height: Number. Image height in pixels (for SVG, PNG, and PDF).
- grid: Boolean. Enable or disable grid rendering.
- transparent: Boolean. Enable or disable transparent background rendering.
- landscape: Boolean. Enable or disable landscape paper format (PDF).
- paperSize: String. Applies when the format is PDF. One of “Letter”, “Legal”, “Tabloid”, “Ledger”, “A0”, “A1”, “A2”, “A3”, “A4”, “A5”.
- projection: String. The visual style of the diagram. One of “isometric” or “2d”.
- theme: String. The color theme of the diagram. One of “light” or “dark”.
Réponse
Wait time exceeded
{
"code": "STILL_PROCESSING",
"message": "Result wait time exceeded. Processing continues in the background, retry to receive result.",
"retry": true
}
Forbidden, insufficient privileges
Exemple de code
curl --location 'https://api.cloudcraft.co/azure/account/{account_id}/{region}/{format}'
package main
import (
"context"
"log"
"os"
"github.com/DataDog/cloudcraft-go"
)
func main() {
// Get the API key from the environment.
key, ok := os.LookupEnv("CLOUDCRAFT_API_KEY")
if !ok {
log.Fatal("missing env var: CLOUDCRAFT_API_KEY")
}
// Check if the command line arguments are correct.
if len(os.Args) != 2 {
log.Fatalf("usage: %s <account-id>", os.Args[0])
}
// Create new Config to 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)
}
// Create a new snapshot of the centralus region with the given account-id
// coming from a command line argument.
snapshot, _, err := client.Azure.Snapshot(
context.Background(),
os.Args[1],
"centralus",
"png",
&cloudcraft.SnapshotParams{
Width: 1920,
Height: 1080,
},
)
if err != nil {
log.Fatal(err)
}
// Save the snapshot to a file.
if err := os.WriteFile("snapshot.png", snapshot, 0o600); err != nil {
log.Fatal(err)
}
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.cloudcraft.co/azure/account/{account_id}/{region}/{format}")
.method("GET", body)
.build();
Response response = client.newCall(request).execute();
import http.client
conn = http.client.HTTPSConnection("api.cloudcraft.co")
payload = ''
headers = {}
conn.request("GET", "/azure/account/{account_id}/{region}/{format}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "net/http"
url = URI("https://api.cloudcraft.co/azure/account/{account_id}/{region}/{format}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://api.cloudcraft.co/azure/account/{account_id}/{region}/{format}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));