### Example GET Request for Access Keys Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to list access keys for an account. It includes standard headers for API versioning, authorization, and content negotiation. ```http GET /my/accesskeys HTTP/1.1 Host: api.example.com date: Tue, 28 Oct 2025 17:03:35 GMT authorization: Signature keyId=... accept: application/json user-agent: triton/7.18.0 (x64-linux; node/22.20.0) accept-version: ~9||~8 ``` -------------------------------- ### Examples of Provision Limit Configurations Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/admin.md These examples demonstrate various ways to configure limits within the Provisioning Limits plugin. They illustrate setting limits based on quota, RAM, OS, image, and brand. ```json { "value": 200, "by": "quota" } ``` ```json { "value": 1024, "by": "ram", "check": "os", "os": "windows" } ``` ```json { "value": 25 } ``` ```json { "value": 100, "check": "brand", "brand": "lx" } ``` ```json { "value": 8192, "by": "ram", "check": "image", "image": "base64-lts" } ``` ```json { "value": 50, "check": "os", "os": "any" } ``` -------------------------------- ### Authentication Setup Source: https://context7.com/tritondatacenter/sdc-cloudapi/llms.txt Instructions and examples for setting up environment variables and HTTP signature authentication for CloudAPI access. ```APIDOC ## Authentication Setup Set up environment variables and HTTP signature authentication for CloudAPI access. ```bash # Set required environment variables export SDC_URL="https://cloudapi.us-central-1.triton.zone" export SDC_ACCOUNT="myaccount" export SDC_KEY_ID=$(ssh-keygen -l -f ~/.ssh/id_rsa.pub | awk '{print $2}' | tr -d '\n') # Generate SSH key if needed ssh-keygen -b 2048 -t rsa -m PEM -f ~/.ssh/id_rsa # Install CLI tools npm install -g triton npm install -g smartdc # Bash function for direct curl access with HTTP signature cloudapi() { local now=$(date -u '+%a, %d %h %Y %H:%M:%S GMT') local signature=$(echo -n "$now" | openssl dgst -sha256 -sign ~/.ssh/id_rsa | openssl enc -e -a | tr -d '\n') local url="$SDC_URL$1" shift curl -s -k -i \ -H 'Accept: application/json' \ -H "accept-version: ~9" \ -H "Date: $now" \ -H "Authorization: Signature keyId=\"/$SDC_ACCOUNT/keys/id_rsa\",algorithm=\"rsa-sha256\" $signature" \ "$@" "$url" echo } # Example: List machines using the curl wrapper cloudapi /my/machines ``` ``` -------------------------------- ### Triton CLI Example for Getting Migration Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md This is a command-line interface (CLI) example using the 'triton' tool to retrieve migration information. It's a concise command for interacting with the migration service. ```bash $ triton inst migration get ``` -------------------------------- ### Example Provisioning Limits Request Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to retrieve provisioning limits for an account. It includes necessary headers like Authorization and Accept-Version. ```http GET /my/limits HTTP/1.1 authorization: Signature keyId="..." accept: application/json accept-version: ~9 host: api.example.com ``` -------------------------------- ### Manual CloudAPI Server Setup Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/README.md Steps to manually set up and run a CloudAPI server from source. This involves cloning the repository, updating submodules, building the project, and starting the server with a configuration file. ```bash git clone git@github.com:TritonDataCenter/sdc-cloudapi.git cd sdc-cloudapi git submodule update --init make all node main.js -f ./etc/cloudapi.config.json ``` -------------------------------- ### Example GET Request for Account Information Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Demonstrates a sample HTTP GET request to retrieve account details. It includes necessary headers like Authorization, Accept, and Host. The response shows a successful 200 OK status with account information in JSON format. ```http GET /my HTTP/1.1 authorization: Signature keyId="..." accept: application/json accept-version: ~8 host: api.example.com ``` -------------------------------- ### List NICs for a Machine (HTTP Request Example) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to list all NICs for a given machine. It includes necessary headers like authorization, accept, and API version. The response is expected in JSON format. ```http GET /my/machine/76a533e9-aa3c-4fd4-a194-03fa05663e0e/nics HTTP/1.1 authorization: Signature keyId="..." accept: application/json accept-version: ~7.1 host: api.example.com connection: keep-alive ``` -------------------------------- ### Triton Instance Migration CLI Commands Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Examples of using the Triton CLI to manage instance migrations. These commands demonstrate starting, listing, syncing, switching, and finalizing migrations, along with observing progress updates. ```bash $ triton instance migration begin eaabc951 -w running: 1% reserving instance Done - begin finished in 28.35352 seconds ``` ```bash $ triton instance migration list SHORTID PHASE STATE AGE eaabc951 begin paused 48s ``` ```bash $ triton instance migration sync eaabc951 -w running: 1% syncing data running: 100% 10.5MB/s Done - sync finished in 12.25971 seconds ``` ```bash $ triton instance migration switch eaabc951 -w running: 3% stopping the instance running: 1% syncing data running: 1% switching instances running: 65% setting up the target filesystem running: 75% hiding the original instance running: 85% promoting the migrated instance running: 90% removing sync snapshots running: 95% starting the migrated instance Done - switch finished in 40.28621 seconds ``` ```bash $ triton instance migration finalize eaabc951 Done - the migration is finalized ``` ```bash $ triton instance migration list SHORTID PHASE STATE AGE eaabc951 switch successful 26m ``` -------------------------------- ### Get Account Configuration API Request Example Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to retrieve account configuration, including headers like Host, Accept, Authorization, and Api-Version. ```http GET /my/config HTTP/1.1 Host: api.example.com Accept: application/json Authorization: Signature keyId... Api-Version: ~8 ``` -------------------------------- ### Example HTTP GET Request for Images Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md This example illustrates a typical HTTP GET request to an API endpoint for retrieving image data. It includes common headers like Host, Authorization, Accept, and Api-Version. ```http GET /my/images HTTP/1.1 Host: api.example.com Authorization: Signature keyId... Accept: application/json Api-Version: ~8 ``` -------------------------------- ### Start Machine Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Boots up a machine instance. This operation requires the machine ID and sets the action parameter to 'start'. ```APIDOC ## StartMachine (POST /:login/machines/:id?action=start) ### Description Allows you to boot up an instance. POST to the instance name with an `action` of `start`. You can poll on [GetMachine](#GetMachine) until the state is `running`. ### Method POST ### Endpoint /:login/machines/:id?action=start ### Parameters #### Query Parameters - **action** (String) - Required - Use the exact string "start" ### Request Example ``` POST /my/machines/c2855c3a-a91d-46b8-9da6-6d7ab1bc6962 HTTP/1.1 Host: api.example.com Authorization: ... Accept: application/json Content-Length: 12 Content-Type: application/x-www-form-urlencoded Api-Version: ~8 action=start ``` ### Response #### Success Response (202 Accepted) - **Api-Version** (String) - The API version used. - **Request-Id** (String) - A unique identifier for the request. - **Response-Time** (Integer) - The time taken to process the request in milliseconds. #### Response Example ``` HTTP/1.1 202 Accepted Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time Access-Control-Allow-Methods: POST, GET, HEAD, DELETE, PUT Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time Connection: Keep-Alive Date: Thu, 21 Jan 2016 13:07:24 GMT Server: cloudapi/8.0.0 Api-Version: 8.0.0 Request-Id: e7fda2e0-c03f-11e5-a64c-d133f917673f Response-Time: 3487 Transfer-Encoding: chunked ``` ``` -------------------------------- ### Get Migration API Request Example (HTTP) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md This snippet demonstrates an example HTTP GET request to retrieve migration details. It includes essential headers like Host, Date, Authorization, Accept, User-Agent, and Accept-Version, targeting a specific migration ID. ```http GET /my/migrations/40c3c6ec-8be5-476a-ca35-c0ea2b0858e3 HTTP/1.1 Host: api.example.com date: Thu, 28 Mar 2019 11:18:44 GMT authorization: ... accept: application/json user-agent: triton/7.0.1 (x64-darwin; node/6.10.3) accept-version: ~9||~8 ``` -------------------------------- ### Example Provision Limits Configuration Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/admin.md This JSON configuration defines default limits, and two categories ('small', 'whale') with specific provisioning constraints for VMs, RAM, and disk quota. Accounts not in a category use defaults. ```json { "defaults": [ { "value": 2 }, { "value": 1024, "by": "ram" } ], "small": [ { "value": 20 }, { "value": 10, "check": "brand", "brand": "kvm" }, { "value": 327680, "by": "ram" }, { "value": 2000, "by": "quota" } ], "whale": [ { "value": 10000 }, { "value": 327680000, "by": "ram" }, { "value": 1000000, "by" :"quota" } ] } ``` -------------------------------- ### CloudAPI Plugin Configuration Example Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/admin.md This JSON snippet demonstrates the configuration structure for CloudAPI plugins. It shows how to enable or disable plugins like 'provision_limits' and 'machine_email', and provides example configuration objects for each, including defaults for provisioning limits and SMTP settings for email notifications. ```json { "plugins": [ { "name": "provision_limits", "enabled": false, "config": { "defaults": [ {"check": "os", "os": "smartos", "value": 1}, {"check": "brand", "brand": "lx", "by": "ram", "value": 8192} ] } }, { "name": "machine_email", "enabled": false, "config": { "smtp": { "host": "127.0.0.1", "port": 25, "secureConnection": false, "auth": { "user": "", "pass": "" } }, "from": "nobody@example.com", "subject": "Your SmartDataCenter machine is provisioning", "body": "Check /my/machines for updates" } } ] } ``` -------------------------------- ### List Users Example Request Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to retrieve a list of users for an account. It includes the host, API version, and authorization header. ```http GET /my/users HTTP/1.1 Accept: application/json Host: api.example.com Api-Version: ~8 Authorization: Signature keyId... ``` -------------------------------- ### Setup Triton CloudAPI Authentication and CLI Tools Source: https://context7.com/tritondatacenter/sdc-cloudapi/llms.txt Configures environment variables for API access, generates SSH keys, and installs necessary CLI tools (triton, smartdc). Includes a bash function for direct curl requests with HTTP signature authentication. ```bash # Set required environment variables export SDC_URL="https://cloudapi.us-central-1.triton.zone" export SDC_ACCOUNT="myaccount" export SDC_KEY_ID=$(ssh-keygen -l -f ~/.ssh/id_rsa.pub | awk '{print $2}' | tr -d '\n') # Generate SSH key if needed ssh-keygen -b 2048 -t rsa -m PEM -f ~/.ssh/id_rsa # Install CLI tools npm install -g triton npm install -g smartdc # Bash function for direct curl access with HTTP signature cloudapi() { local now=$(date -u '+%a, %d %h %Y %H:%M:%S GMT') local signature=$(echo -n "$now" | openssl dgst -sha256 -sign ~/.ssh/id_rsa | openssl enc -e -a | tr -d '\n') local url="$SDC_URL$1" shift curl -s -k -i \ -H 'Accept: application/json' \ -H "accept-version: ~9" \ -H "Date: $now" \ -H "Authorization: Signature keyId=\"/$SDC_ACCOUNT/keys/id_rsa\",algorithm=\"rsa-sha256\" $signature" \ "$@" "$url" echo } # Example: List machines using the curl wrapper cloudapi /my/machines ``` -------------------------------- ### Use 'any' for OS or Image Check Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/admin.md This example shows using 'any' for the 'image' or 'os' check, which is equivalent to not using the 'check' attribute at all. It limits disk usage across the entire datacenter. ```json { "value": 900, "by": "quota", "check": "os", "os": "any" } ``` ```json { "value": 900, "by": "quota" } ``` -------------------------------- ### Install node-smartdc CLI Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Installs the node-smartdc command-line interface globally using npm. This CLI provides access to Triton CloudAPI functionalities. Node.js and npm are prerequisites for installation. ```bash $ npm install -g smartdc ``` -------------------------------- ### List Firewall Rules using Triton CLI, sdc- CLI, and HTTP Source: https://context7.com/tritondatacenter/sdc-cloudapi/llms.txt Shows how to list all configured firewall rules for an account. Examples are provided for the `triton fwrule list` command, the `sdc-listfirewallrules` command, and a direct HTTP GET request. The response format is a JSON array of rule objects. ```bash triton fwrule list ``` ```bash sdc-listfirewallrules ``` ```http GET /my/fwrules HTTP/1.1 Host: api.example.com Authorization: Signature keyId="/myaccount/keys/id_rsa",algorithm="rsa-sha256" Accept: application/json Accept-Version: ~9 ``` -------------------------------- ### Get Firewall Rule API Request Example Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to the CloudAPI endpoint for retrieving a specific firewall rule by its ID. ```http GET /login/fwrules/38de17c4-39e8-48c7-a168-0f58083de860 HTTP/1.1 authorization: Signature keyId="... accept: application/json accept-version: ~8 host: api.example.com ``` -------------------------------- ### Get Specific NIC Details (HTTP Request Example) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to retrieve details of a specific NIC on a machine. The MAC address in the URL path should have colons removed. It requires appropriate authorization and version headers. ```http GET /my/machine/76a533e9-aa3c-4fd4-a194-03fa05663e0e/nics/90b8d02fb8f9 HTTP/1.1 authorization: Signature keyId="..." accept: application/json accept-version: ~7.1 host: api.example.com connection: keep-alive ``` -------------------------------- ### CloudAPI Example Rule: List and Get Machines Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Provides an example of a CloudAPI Aperture policy rule that grants permissions to list and get machine details. This rule would be associated with a role that users must possess to perform these actions. ```plaintext CAN listmachines and getmachines ``` -------------------------------- ### Setup CloudAPI Environment for RBAC Testing Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/README.md This script assists in setting up the environment for RBAC testing in CloudAPI. It involves creating accounts, users, and configuring environment variables for authentication. ```bash ./tools/create-account.sh headnode export SDC_URL=https:// export SDC_TESTING=true export SDC_ACCOUNT=account export SDC_KEY_ID=`ssh-keygen -l -E md5 -f ~/.ssh/id_rsa.pub| awk '{print $2}' | tr -d '\n'|cut -c 5-` export SDC_USER=user /zones/`vmadm lookup -1 alias=cloudapi0`/root/opt/smartdc/cloudapi/tools/coal-setup.sh ``` -------------------------------- ### Example Provisioning Limits Response Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP 200 OK response containing an array of provisioning limit objects. Each object details limits for 'machines', 'ram', or 'quota', including 'by', 'value', and 'used' fields, with optional 'check', 'os', and 'image' fields. ```json [ { "by": "machines", "value": 100, "used": 2 }, { "by": "ram", "value": 1024, "used": 512 }, { "check": "os", "os": "linux", "by": "quota", "value": 1024, "used": 1 } ] ``` -------------------------------- ### List Firewall Rules API Request Example Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to the CloudAPI endpoint for listing firewall rules. ```http GET /login/fwrules HTTP/1.1 authorization: Signature keyId="... accept: application/json accept-version: ~8 host: api.example.com connection: keep-alive ``` -------------------------------- ### Start Machine from Snapshot (SDC CLI) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Starts an instance from a specified snapshot using the sdc command-line tool. This provides an alternative method for rolling back an instance's state to a snapshot. ```bash $ sdc-startmachinefromsnapshot --snapshot=just-booted 5e42cd1e-34bb-402f-8796-bf5a2cae47db ``` -------------------------------- ### Get Firewall Rule API Response Example Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP 200 OK response containing a single firewall rule object. ```json { "id": "38de17c4-39e8-48c7-a168-0f58083de860", "rule": "FROM vm 3d51f2d5-46f2-4da5-bb04-3238f2f64768 TO subnet 10.99.99.0/24 BLOCK tcp PORT 25", "enabled": true } ``` -------------------------------- ### Get Fabric VLAN (HTTP Request) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Example HTTP GET request to retrieve a specific VLAN object by its ID. Requires the VLAN ID in the URL path. ```http GET /login/fabrics/default/vlans/2 HTTP/1.1 Authorization: Basic ... Host: api.example.com Accept: application/json Accept-version: ~7.3 ``` -------------------------------- ### CloudAPI HTTP Request Example Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example of an HTTP GET request to retrieve firewall rules for a specific instance. Includes necessary headers like Authorization and Api-Version. ```http GET /my/fwrules/38de17c4-39e8-48c7-a168-0f58083de860/machines HTTP/1.1 Authorization: ... Host: api.example.com Accept: application/json Api-Version: ~8 ``` -------------------------------- ### Get Machine Metadata using HTTP Request Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Example HTTP GET request to retrieve metadata for a specific machine. Includes Authorization, Host, Accept, and Api-Version headers. ```http GET /my/machines/cf055959-d776-482e-bd71-ca510a04bdd7/metadata/foo HTTP/1.1 Authorization: ... Host: api.example.com Accept: application/json Api-Version: ~8 ``` -------------------------------- ### CloudAPI Accept-Version Header Examples Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Illustrates various ways to specify acceptable API version ranges using the 'Accept-Version' header. These examples cover specific versions, ranges, and wildcards. ```http Accept-Version: ~8 // accept any 8.x version Accept-Version: 7.0.0 // require exactly this version Accept-Version: ~8||~7 // accept 8.x or 7.x Accept-Version: * // the latest version (wild west) ``` -------------------------------- ### Example Request to List Fabric Networks Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP GET request to retrieve a list of all networks within a specified VLAN. This request includes authentication and versioning headers. ```http GET /login/fabrics/default/vlans/2/networks HTTP/1.1 Authorization: Basic ... Host: api.example.com Accept: application/json Accept-version: ~7.3 ``` -------------------------------- ### List Networks using CLI and HTTP Source: https://context7.com/tritondatacenter/sdc-cloudapi/llms.txt Shows how to list all available networks for instance provisioning using the triton CLI, sdc-* CLI, and a direct HTTP GET request. ```bash triton network list ``` ```bash sdc-listnetworks ``` ```http GET /my/networks HTTP/1.1 Host: api.example.com Authorization: Signature keyId="/myaccount/keys/id_rsa",algorithm="rsa-sha256" Accept: application/json Accept-Version: ~9 ``` -------------------------------- ### Start Machine using Triton CLI, sdc-startmachine, and HTTP Source: https://context7.com/tritondatacenter/sdc-cloudapi/llms.txt Starts a stopped instance. Can be performed using the triton CLI, the sdc-startmachine utility, or a direct HTTP POST request with the '?action=start' query parameter. The '-w' flag with triton CLI waits for the instance to reach the running state. ```bash # Using triton CLI triton instance start webserver-01 # Wait for running state triton instance start -w webserver-01 ``` ```bash # Using sdc-* CLI sdc-startmachine b6979942-7d5d-4fe6-a2ec-b812e950625a ``` ```http POST /my/machines/b6979942-7d5d-4fe6-a2ec-b812e950625a?action=start HTTP/1.1 Host: api.example.com Authorization: Signature keyId="/myaccount/keys/id_rsa",algorithm="rsa-sha256" Accept-Version: ~9 ``` -------------------------------- ### Get Account Configuration API Response Example Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP 200 OK response for retrieving account configuration, containing the default network ID in JSON format. ```http HTTP/1.1 200 OK Content-Type: application/json Content-Length: 58 Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time Access-Control-Allow-Methods: GET, HEAD, PUT Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time Connection: Keep-Alive Content-MD5: 0ZhWHGmb65TwGb3V1+XFlA== Date: Thu, 21 Jan 2016 05:23:10 GMT Server: cloudapi/8.0.0 Api-Version: 8.0.0 Request-Id: 0faa8fb0-bfff-11e5-a42d-41bc4fcc136a Response-Time: 379 { "default_network": "45607081-4cd2-45c8-baf7-79da760fffaa" } ``` -------------------------------- ### Get Individual Datacenter (HTTP Request) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Example HTTP GET request to retrieve information about a specific datacenter by its name. The response is typically an HTTP redirect to the datacenter's URL. ```http GET /my/datacenters/example HTTP/1.1 Host: api.example.com Authorization: Signature keyId... Accept: application/json Api-Version: ~8 ``` -------------------------------- ### Example Response for Creating Machine Disk Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP response for a successful machine disk creation when a PCI slot is provided. It includes details of the newly created disk such as its ID, PCI slot, size, boot status, and current state. ```http HTTP/1.1 200 OK Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, POST Connection: close Date: Tue, 05 Dec 2018 17:19:26 GMT Server: cloudapi/9.4.0 Api-Version: 9.0.0 Request-Id: 4bcf467e-4b88-4ab4-b7ab-65fad7464de9 Response-Time: 754 Content-Type: application/json Content-Length: 0 { "id": "21f04764-1db8-47dc-acfd-2215f2b842e9", "pci_slot": "0:4:1", "size": 1024, "boot": false, "state": "creating" } ``` -------------------------------- ### Create Instance NIC using Triton CLI, sdc- CLI, and HTTP Source: https://context7.com/tritondatacenter/sdc-cloudapi/llms.txt Demonstrates how to create a network interface (NIC) for a Triton instance. It shows the equivalent commands for the `triton` CLI, the `sdc-nics` CLI, and a direct HTTP POST request. Requires instance ID and network ID. ```bash triton instance nic create webserver-01 45607081-4cd2-45c8-baf7-79da760fffaa ``` ```bash sdc-nics create --network=45607081-4cd2-45c8-baf7-79da760fffaa b6979942-7d5d-4fe6-a2ec-b812e950625a ``` ```http POST /my/machines/b6979942-7d5d-4fe6-a2ec-b812e950625a/nics HTTP/1.1 Host: api.example.com Authorization: Signature keyId="/myaccount/keys/id_rsa",algorithm="rsa-sha256" Content-Type: application/json Accept-Version: ~9 { "network": "45607081-4cd2-45c8-baf7-79da760fffaa" } ``` -------------------------------- ### Get User Details (HTTP Request) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Example HTTP GET request to retrieve user details from the SDC Cloud API. Includes necessary headers like Host, Api-Version, and Authorization. ```http GET /my/users/4fc13ac6-1e7d-cd79-f3d2-96276af0d638 HTTP/1.1 Accept: application/json Host: api.example.com Api-Version: ~8 Authorization: Signature keyId... ``` -------------------------------- ### Example API Request to List Machines Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md This is an example HTTP GET request to the Triton CloudAPI endpoint for listing machines. It includes standard headers like Authorization, Host, Accept, and Api-Version. ```http GET /my/machines HTTP/1.1 Authorization: ... Host: api.example.com Accept: application/json Api-Version: ~8 ``` -------------------------------- ### Ping Endpoint Request Example Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Shows an example GET request to the /--ping endpoint, including necessary headers like 'accept' and 'accept-version'. This endpoint provides information about supported API versions. ```http GET /--ping accept: application/json accept-version: ~8 ``` -------------------------------- ### Create Triton Instance using CLI Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Demonstrates how to create a new Triton instance using the `triton instance create` command or the `sdc-createmachine` utility. Requires image and package identifiers. Supports optional network and tag parameters. ```bash $ triton instance create 2b683a82-a066-11e3-97ab-2faa44701c5a 7b17343c-94af-6266-e0e8-893a3b9993d0 or $ sdc-createmachine --image=2b683a82-a066-11e3-97ab-2faa44701c5a --package=7b17343c-94af-6266-e0e8-893a3b9993d0 ``` ```bash # Create instance with multiple nics $ triton instance create --network=42325ea0-eb62-44c1-8eb6-0af3e2f83abc --network=c8cde927-6277-49ca-82a3-741e8b23b02f 2b683a82-a066-11e3-97ab-2faa44701c5a 7b17343c-94af-6266-e0e8-893a3b9993d0 or $ sdc-createmachine --image=2b683a82-a066-11e3-97ab-2faa44701c5a --package=7b17343c-94af-6266-e0e8-893a3b9993d0 --networks=42325ea0-eb62-44c1-8eb6-0af3e2f83abc --networks=c8cde927-6277-49ca-82a3-741e8b23b02f ``` ```bash # Create instance with tags $ triton instance create -t foo=bar -t group=test 2b683a82-a066-11e3-97ab-2faa44701c5a 7b17343c-94af-6266-e0e8-893a3b9993d0 or $ sdc-createmachine --image=2b683a82-a066-11e3-97ab-2faa44701c5a --package=7b17343c-94af-6266-e0e8-893a3b9993d0 -t foo=bar -t group=test ``` -------------------------------- ### Create Machine Snapshot using CLI and HTTP Source: https://context7.com/tritondatacenter/sdc-cloudapi/llms.txt Provides examples for creating a point-in-time snapshot of a Triton instance using the triton CLI, sdc-* CLI, and a direct HTTP POST request with a JSON payload. ```bash triton instance snapshot create webserver-01 --name=pre-upgrade-snapshot ``` ```bash sdc-createmachinesnapshot --name=pre-upgrade-snapshot b6979942-7d5d-4fe6-a2ec-b812e950625a ``` ```http POST /my/machines/b6979942-7d5d-4fe6-a2ec-b812e950625a/snapshots HTTP/1.1 Host: api.example.com Authorization: Signature keyId="/myaccount/keys/id_rsa",algorithm="rsa-sha256" Content-Type: application/json Accept-Version: ~9 { "name": "pre-upgrade-snapshot" } ``` -------------------------------- ### Example Request for Creating Machine Disk Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md An example HTTP POST request to create a machine disk, specifying the PCI slot and size. This demonstrates the required headers and the format of the request body. ```http POST /my/machines/5e42cd1e-34bb-402f-8796-bf5a2cae47db/disks HTTP/1.1 Authorization: ... Host: api.example.com Accept: application/json Content-Length: 12 Content-Type: application/x-www-form-urlencoded Api-Version: ~9 pci_slot=0:4:1 size=1024 ``` -------------------------------- ### Create Role using CLI Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Demonstrates how to create a role using the sdc-role CLI command. It shows basic usage and alternative formats for passing multiple members or policies using CSV or JSON. ```bash $ sdc-role create --name=readable --members=foo --default-members=foo --policies=readinstance $ sdc-role create --name=readable --members=bob,fred --default-members=foo --policies=readinstance $ sdc-role create --name=readable --members='["bob","fred"]' --default-members=foo --policies=readinstance ``` -------------------------------- ### Get Instance Details using Triton CloudAPI HTTP Request Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md This example demonstrates how to fetch instance details using an HTTP GET request to the Triton CloudAPI. It includes necessary headers like Authorization and Api-Version for proper authentication and API versioning. ```http GET /my/machines/b6979942-7d5d-4fe6-a2ec-b812e950625a HTTP/1.1 Authorization: ... Host: api.example.com Accept: application/json Api-Version: ~8 ``` -------------------------------- ### Get Network Details using API Request Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md This is an example of an HTTP GET request to retrieve the details of a specific network. The request includes the login, VLAN ID, and network ID in the URL path. The API returns the network object upon successful retrieval. ```http GET /login/fabrics/default/vlans/2/networks/7fa999c8-0d2c-453e-989c-e897716d0831 HTTP/1.1 Authorization: Basic ... Host: api.example.com Accept: application/json Accept-version: ~7.3 ``` -------------------------------- ### Create Policy Example Request (HTTP) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Example HTTP POST request to create a new policy. It includes the policy name, rules, and an optional description in the JSON body. ```http POST /my/policies HTTP/1.1 Accept: application/json Content-Type: application/json Host: api.example.com Api-Version: ~7.2 Authorization: Signature keyId... { "name": "test-policy", "rules": ["can rebootMachine"], "description": "can reboot any instance" } ``` -------------------------------- ### Provide User Script for Instance Initialization Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Specifies a user script to be executed upon instance creation and reboot. The script is provided as an absolute path to a file uploaded to the instance. ```bash triton instance create --script /path/to/your/script.sh ... ``` -------------------------------- ### List Machine Snapshots using CLI and HTTP Source: https://context7.com/tritondatacenter/sdc-cloudapi/llms.txt Demonstrates how to list all snapshots for a Triton instance using the triton CLI, sdc-* CLI, and a direct HTTP GET request. ```bash triton instance snapshot list webserver-01 ``` ```bash sdc-listmachinesnapshots b6979942-7d5d-4fe6-a2ec-b812e950625a ``` ```http GET /my/machines/b6979942-7d5d-4fe6-a2ec-b812e950625a/snapshots HTTP/1.1 Host: api.example.com Authorization: Signature keyId="/myaccount/keys/id_rsa",algorithm="rsa-sha256" Accept: application/json Accept-Version: ~9 ``` -------------------------------- ### List Fabric VLANs (HTTP Request) Source: https://github.com/tritondatacenter/sdc-cloudapi/blob/master/docs/index.md Example HTTP GET request to list all VLAN objects on the fabric. Requires authentication and specifies the API version. ```http GET /login/fabrics/default/vlans HTTP/1.1 Authorization: Basic ... Host: api.example.com Accept: application/json Accept-version: ~7.3 ```