PUT /blueprint/{blueprint_id}
Overview
Update an existing blueprint.
The body of the request should contain the updated blueprint document in JSON format.
Optionally, a conditional update of the blueprint can be perfomed by including the If-Match HTTP header with the same ETag value as provided by the “Retrieve blueprint” API. If the blueprint has been modified since the retrieval, the update is rejected with a 412 Resource out of date response. If the update succeeds, the new ETag is returned.
Response
Forbidden, insufficient privileges
Code Example
curl --location --request PUT 'https://api.cloudcraft.co/blueprint/{blueprint_id}' \ --data '{"data": "%!s(<nil>)", }'
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) != 3 { log.Fatalf("usage: %s <blueprint-id> <blueprint-name>", 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) } // Update the blueprint with the ID and name coming from command line // arguments. Add a new EC2 node to the blueprint. _, err = client.Blueprint.Update( context.Background(), &cloudcraft.Blueprint{ ID: os.Args[1], Name: os.Args[2], Data: &cloudcraft.BlueprintData{ Name: os.Args[2], Nodes: []map[string]any{ { "id": "98172baa-a059-4b04-832d-8a7f5d14b595", "type": "ec2", "region": "us-east-1", "platform": "linux", "instanceType": "m5", "instanceSize": "large", }, }, }, }, "", ) if err != nil { log.Fatal(err) } }
OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("text/plain"); RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"My updated AWS Account\",\n \"roleArn\": \"arn:aws:iam::1234567890:role/cloudcraft\"\n}\n"); Request request = new Request.Builder() .url("https://api.cloudcraft.co/blueprint/{blueprint_id}") .method("PUT", body) .build(); Response response = client.newCall(request).execute();
from cloudcraftco import Cloudcraft cloudcraft = Cloudcraft() blueprint_id = 1234 data = { "data": { "grid": "standard", "name": "Updated blueprint", "text": [ { "id": "label1", "text": "Hello\nWorld!", "type": "isotext", "color": "#f5b720", "mapPos": [0, 0], "textSize": 15, } ], } } result = cloudcraft.update_blueprint(blueprint_id, data)
require "uri" require "net/http" url = URI("https://api.cloudcraft.co/blueprint/{blueprint_id}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Put.new(url) request.body = "{\n \"name\": \"My updated AWS Account\",\n \"roleArn\": \"arn:aws:iam::1234567890:role/cloudcraft\"\n}\n" response = https.request(request) puts response.read_body
var raw = "{\n \"name\": \"My updated AWS Account\",\n \"roleArn\": \"arn:aws:iam::1234567890:role/cloudcraft\"\n}\n"; var requestOptions = { method: 'PUT', body: raw, redirect: 'follow' }; fetch("https://api.cloudcraft.co/blueprint/{blueprint_id}", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));