### Create Operating System - JavaScript SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/operating-system/create-operating-system.md JavaScript example using fetch to POST a new operating system. Uses async/await and logs the response or error. ```javascript const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/operating-system'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"name":"debian-12-amd64","description":"Official Debian 12 for AMD/Intel","siteIds":["497f6eca-6276-4993-bfeb-53cbbbba6f08"],"imageUrl":"https://saimei.ftp.acc.umu.se/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2","imageSha":"2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae","imageAuthType":"Bearer","imageAuthToken":"acbd18db4cc2f85cedef654fccc4a4d8","imageDisk":"/dev/sda","rootFsId":"6c2ac315-3040-4728-94eb-b66d320206c1","rootFsLabel":null,"phoneHomeEnabled":false,"userData":null,"allowOverride":false,"tenantId":"f97df110-f4de-492e-8849-4a6af68026b0","isCloudInit":false}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Get Rack Response Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/rack/get-rack.md Example JSON response for a successful Get Rack request. Shows a rack with a component and its BMC details. ```json { "operationStatus": "Ready", "nvLinkDomainIds": [ "59202b81-65fb-45ec-b3b8-91ab0ad3f34a" ], "taskStats": { "pendingTaskCount": 0, "activeTaskCount": 0 }, "health": null, "id": "rack-01", "name": "Rack-01", "manufacturer": "Dell", "model": "PowerEdge R750", "serialNumber": "SN-RACK-001", "description": "Primary compute rack", "location": { "region": "us-east-1", "datacenter": "DC-01", "room": "Room-A", "position": "A1" }, "components": [ { "health": null, "id": "fm100ht4v4mce2qstjnl8970nnj3ie6ecek4mtjn27pea4kre5gsa49jg0g", "type": "Compute", "name": "Server-01", "serialNumber": "SN-SRV-001", "manufacturer": "Dell", "firmwareVersion": "2.1.0", "slotId": 1, "trayIdx": 0, "hostId": 0, "bmcs": [ { "type": "BmcTypeHost", "macAddress": "AA:BB:CC:DD:EE:01", "ipAddress": "10.0.0.101" } ], "powerState": "on", "leakStatus": "NoLeak", "leakHandlingStatus": "None" } ] } ``` -------------------------------- ### Get VPC SDK Examples (Python, JavaScript, Go, Ruby, Java, PHP, C#) Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/vpc/get-vpc.md SDK code examples for calling the GET VPC endpoint. Each example sends an HTTP GET request to the VPC URL with an Authorization header and prints or returns the response. The examples are provided in Python, JavaScript, Go, Ruby, Java, PHP, and C#. ```python import requests url = "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/vpc/vpcId" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/vpc/vpcId'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/vpc/vpcId" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/vpc/vpcId") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/vpc/vpcId") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/vpc/vpcId', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/vpc/vpcId"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### turn-on Go SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/machine/power-control-machine.md Go example using net/http to send a PATCH request with the 'On' action. Prints the response status and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/machine/machineId/power" payload := strings.NewReader("{\n \"action\": \"On\"\n}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get All NVLink Logical Partition - C# Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/nv-link-logical-partition/get-all-nvlink-logical-partition.md C# SDK example using RestSharp to call the Get All NVLink Logical Partition endpoint. Creates a GET request with an Authorization header and executes it. ```csharp using RestSharp; var client = new RestClient("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/nvlink-logical-partition?pageSize=20"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Create Operating System - Go SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/operating-system/create-operating-system.md Go example using net/http to POST a new operating system. Constructs a JSON payload as a string and sends the request with headers. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/operating-system" payload := strings.NewReader("{\n \"name\": \"debian-12-amd64\",\n \"description\": \"Official Debian 12 for AMD/Intel\",\n \"siteIds\": [\n \"497f6eca-6276-4993-bfeb-53cbbbba6f08\"\n ],\n \"imageUrl\": \"https://saimei.ftp.acc.umu.se/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2\",\n \"imageSha\": \"2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae\",\n \"imageAuthType\": \"Bearer\",\n \"imageAuthToken\": \"acbd18db4cc2f85cedef654fccc4a4d8\",\n \"imageDisk\": \"/dev/sda\",\n \"rootFsId\": \"6c2ac315-3040-4728-94eb-b66d320206c1\",\n \"rootFsLabel\": null,\n \"phoneHomeEnabled\": false,\n \"userData\": null,\n \"allowOverride\": false,\n \"tenantId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n \"isCloudInit\": false\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK example for Create NVLink Logical Partition Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/nv-link-logical-partition/create-nvlink-logical-partition.md Go example using net/http to POST a new NVLink Logical Partition. Requires a valid bearer token and the site ID. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/nvlink-logical-partition" payload := strings.NewReader("{\n \"name\": \"partition-east-gpu\",\n \"siteId\": \"69dae3c8-3554-4a1f-b391-858c6dc47fff\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### JavaScript SDK Example for Get SKU Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/sku/get-sku.md JavaScript example using fetch to call the Get SKU endpoint. Requires a valid bearer token. ```javascript const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/sku/skuId'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Get All NVLink Logical Partition - PHP Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/nv-link-logical-partition/get-all-nvlink-logical-partition.md PHP SDK example using Guzzle to call the Get All NVLink Logical Partition endpoint. Sends a GET request with an Authorization header and prints the response body. ```php request('GET', 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/nvlink-logical-partition?pageSize=20', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Components deployed by setup.sh Source: https://docs.nvidia.com/infra-controller/documentation/getting-started/quick-start-guide.md Text output listing the components installed by the setup script, including their sources and configuration details. ```text local-path-provisioner (raw manifest - StorageClasses for Vault + PostgreSQL PVCs) metallb (metallb/metallb 0.14.5 - LoadBalancer IPs via BGP or L2) contour + envoy (optional - Ingress controller for REST API FQDN/TLS) postgres-operator (zalando/postgres-operator 1.11.0 - manages nico-pg-cluster) cert-manager (jetstack/cert-manager v1.17.1) vault (hashicorp/vault 0.25.0, 3-node HA Raft, TLS) external-secrets (external-secrets/external-secrets 0.14.3) DPF stack (default; --skip-dpf to opt out: argo-cd, kamaji, NFD, maintenance-operator, dpf-operator from the pinned doca-platform commit: the submodule in a git checkout or doca-platform.pin from the packaged chart; the NICO_DPF_SRC override installs an operator-managed checkout instead - see docs/manuals/dpf.md) rack-manager (RMS) (default; --skip-rms to opt out - pinned nv-rms submodule, mTLS via vault-nico-issuer, rms database on nico-pg-cluster) nico-prereqs (this Helm chart - nico-system namespace) NICo Core (../helm - nico-core.yaml values) NICo REST (../helm/rest/nico-rest) ├── nico-rest-ca-issuer (ClusterIssuer - cert-manager.io) ├── postgres StatefulSet (temporal + keycloak databases) ├── keycloak (dev OIDC IdP, nico-dev realm) ├── temporal (temporal-helm/temporal, mTLS) └── nico-rest (API, cert-manager, workflow, site-manager) NICo Flow (../helm/nico-flow) NICo REST site-agent (../helm/rest/nico-rest-site-agent - StatefulSet, bootstrap via site-manager) ``` -------------------------------- ### Go SDK example for Get All Tray Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/tray/get-all-tray.md Uses the net/http package to send a GET request to the tray endpoint with pageSize and siteId query parameters. Requires an Authorization header with a bearer token. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray?pageSize=20&siteId=siteId" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get All NVLink Logical Partition - Java Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/nv-link-logical-partition/get-all-nvlink-logical-partition.md Java SDK example using Unirest to call the Get All NVLink Logical Partition endpoint. Sends a GET request with an Authorization header and retrieves the response as a string. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/nvlink-logical-partition?pageSize=20") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Get Tray - Response Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/tray/get-tray.md Example JSON response from the Get Tray endpoint, showing tray details such as nvLinkDomainId, taskStats, health, position, and rackId. ```json { "nvLinkDomainId": "59202b81-65fb-45ec-b3b8-91ab0ad3f34a", "taskStats": { "pendingTaskCount": 0, "activeTaskCount": 0 }, "health": null, "id": "fm100ht4v4mce2qstjnl8970nnj3ie6ecek4mtjn27pea4kre5gsa49jg0g", "type": "Compute", "name": "compute-tray-1", "manufacturer": "NVIDIA", "model": "GB200", "serialNumber": "TSN001", "description": "Compute tray in slot 1", "firmwareVersion": "2.1.0", "powerState": "on", "leakStatus": "Leaking", "leakHandlingStatus": "Failed", "position": { "slotId": 1, "trayIdx": 0, "hostId": 1 }, "rackId": "rack-01" } ``` -------------------------------- ### Go SDK example for Get All Operating Systems Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/operating-system/get-all-operating-system.md Uses the net/http package to send a GET request to the operating-system endpoint with a pageSize query parameter and an Authorization bearer token, then prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/operating-system?pageSize=20" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK example for Get All Task Run Targets Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/task-run/get-all-task-run-target.md Uses the net/http package to send a GET request to the endpoint with a siteId query parameter and an Authorization header. Prints the response and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/task/run/id/target?siteId=siteId" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Task Response Example (JSON) Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/task/get-task.md Example JSON response from the Get Task endpoint, showing task ID, status, description, and message fields. ```json { "id": "550e8400-e29b-41d4-a716-446655440000", "status": "Running", "description": "Power on rack components", "message": "Processing 3 of 5 components" } ``` -------------------------------- ### Python SDK Example for Get SKU Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/sku/get-sku.md Python example using the requests library to call the Get SKU endpoint. Requires a valid bearer token. ```python import requests url = "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/sku/skuId" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Create Operating System - JavaScript SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/operating-system/create-operating-system.md JavaScript example using fetch to POST a new operating system to the API endpoint. Requires a valid bearer token. ```javascript const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/operating-system'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"name":"ubuntu-official-22.04","description":"Official Ubuntu 22.04","phoneHomeEnabled":true,"userData":"#cloud-config\nautoinstall:\n apt:\n geoip: true\n preserve_sources_list: false\n primary:\n - arches: [amd64, i386]\n uri: http://archive.ubuntu.com/ubuntu\n - arches: [default]\n uri: http://ports.ubuntu.com/ubuntu-ports","allowOverride":false,"tenantId":"f97df110-f4de-492e-8849-4a6af68026b0","ipxeScript":"#!ipxe\nkernel http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux initrd=initrd.gz\ninitrd http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz\nboot || imgfree\n shell","isCloudInit":true}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Go SDK Example for Get All SpectrumX Partitions Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/spectrum-x-partition/get-all-spectrumx-partition.md Uses the net/http package to send a GET request to the SpectrumX partition endpoint with a pageSize query parameter and Bearer token authorization. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/spectrumx-partition?pageSize=20" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go example: GET instance status history with net/http Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/instance/get-instance-status-history.md Go example using net/http to send a GET request with a Bearer token and print the response. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/instance/instanceId/status-history" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get All NVLink Logical Partition - Swift Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/nv-link-logical-partition/get-all-nvlink-logical-partition.md Swift SDK example using URLSession to call the Get All NVLink Logical Partition endpoint. Sends a GET request with an Authorization header and prints the HTTP response or error. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/nvlink-logical-partition?pageSize=20")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Example Boot Order Output Source: https://docs.nvidia.com/infra-controller/documentation/operations-day-2/playbooks/stuck-objects/adding-new-machines-to-an-existing-site.md Shows a sample output of efibootmgr where the boot order is already correct, with NET-OOB-IPV4-HTTP as the first boot entry. ```text BootCurrent: 0040 Timeout: 3 seconds BootOrder: 0000,0040,0001,0002,0003 Boot0000* NET-OOB-IPV4-HTTP Boot0001* NET-OOB.4040-IPV4 Boot0002* UiApp Boot0003* EFI Internal Shell Boot0040* ubuntu0 ``` -------------------------------- ### Get All NVLink Logical Partition - Ruby Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/nv-link-logical-partition/get-all-nvlink-logical-partition.md Ruby SDK example using net/http to call the Get All NVLink Logical Partition endpoint. Sets up an HTTPS GET request with an Authorization header and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/nvlink-logical-partition?pageSize=20") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Create Allocation Go SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/allocation/create-allocation.md Go example using net/http to POST to the allocation endpoint. Requires a valid bearer token. Prints the response status and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/allocation" payload := strings.NewReader("{\n \"name\": \"Echo Studios\",\n \"tenantId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n \"siteId\": \"60189e9c-7d12-438c-b9ca-6998d9c364b1\",\n \"description\": \"Echo Studios resource allocation in SJC4\",\n \"allocationConstraints\": [\n {\n \"resourceType\": \"InstanceType\",\n \"resourceTypeId\": \"bd5a0240-eb62-4bff-91f7-335e6bb86459\",\n \"constraintType\": \"Reserved\",\n \"constraintValue\": 10\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get VPC Response Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/vpc/get-vpc.md Example JSON response for a successful GET VPC request. Shows the VPC object with fields such as id, name, status, and networkSecurityGroupPropagationDetails. ```json { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "spark-vpc", "description": "Virtual network for machines executing Spark jobs", "org": "xskkpgqpeakn", "tenantId": "34f5c98e-f430-457b-a812-92637d0c6fd0", "siteId": "72771e6a-6f5e-4de4-a5b9-1266c4197811", "controllerVpcId": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "networkVirtualizationType": "ETHERNET_VIRTUALIZER", "slaacEnabled": false, "requestedVni": 12001, "vni": 12001, "networkSecurityGroupId": "c602eb90-3039-11f0-997a-b38d4fc8389e", "networkSecurityGroupPropagationDetails": { "objectId": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "detailedStatus": "Partial", "status": "Synchronizing", "details": "", "unpropagatedInstanceIds": [ "497f6eca-6276-4993-bfeb-53cbbbba6f08" ], "relatedInstanceIds": [ "497f6eca-6276-4993-bfeb-53cbbbba6f08" ] }, "nvLinkLogicalPartitionId": "dd887330-dbd3-45ce-b400-c42fc8e47315", "labels": { "env": "dev", "region": "us-west-1" }, "status": "Ready", "statusHistory": [ { "status": "Ready", "message": "VPC has been successfully provisioned on Site", "created": "2019-08-24T16:02:00Z", "updated": "2019-08-24T16:02:00Z" }, { "status": "Pending", "message": "Request received, pending processing", "created": "2019-08-24T14:15:22Z", "updated": "2019-08-24T14:15:22Z" } ], "created": "2019-08-24T14:15:22Z", "updated": "2019-08-24T14:15:22Z" } ``` -------------------------------- ### JavaScript SDK Example for PUT Host Firmware Config Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/host-firmware-config/create-or-update-host-firmware-config.md JavaScript example using fetch to PUT a host firmware configuration. Uses async/await and logs the response data or error. ```javascript const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/firmware-config/host'; const options = { method: 'PUT', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"siteId":"00000000-0000-0000-0000-000000000001","vendor":"Nvidia","model":"DGXH100","components":[{"type":"Cx7","firmware":[{"version":"28.47.2682","artifacts":[{"url":"https://firmware.example.invalid/28.47.2682/fw.bin","sha256":"a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"}],"default":true,"installOnlySpecified":true,"powerDrainsNeeded":1,"preUpdateResets":true}]}],"explicitStartNeeded":true,"ordering":["Cx7","BMC"]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Get Tray - JavaScript SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/tray/get-tray.md JavaScript example using fetch to GET a tray by ID. Requires a valid bearer token and siteId query parameter. ```javascript const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id?siteId=siteId'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Create VPC Prefix - Go SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/vpc-prefix/create-vpc-prefix.md Go example using net/http to POST to the VPC prefix endpoint. Reads the response body and prints the response and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/vpc-prefix" payload := strings.NewReader("{\n \"ipBlockId\": \"8c1d1a06-90a2-4863-8ee1-6029265b9f0a\",\n \"name\": \"east-vpc-traffic-net\",\n \"prefixLength\": 20,\n \"vpcId\": \"5e28ad7c-5fb7-46d6-a28a-fc0ba6fdc4a3\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Tray - Python SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/tray/get-tray.md Python example using requests to GET a tray by ID. Requires a valid bearer token and siteId query parameter. ```python import requests url = "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/tray/id" querystring = {"siteId":"siteId"} headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` -------------------------------- ### Go SDK example for retrieving all SSH keys Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/ssh-key/get-all-ssh-key.md Uses net/http to send a GET request with a pageSize query parameter and prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/sshkey?pageSize=20" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/rack/get-all-rack-health-report.md Go example using net/http to GET the rack health report. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/rack/id/health-report?siteId=siteId" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Task Run - Java SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/task-run/get-task-run.md Java example using Unirest to GET a task run with siteId query parameter and Bearer token authentication. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/task/run/id?siteId=siteId") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Create Operating System - Python SDK Example Source: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/operating-system/create-operating-system.md Python example using requests to POST a new operating system to the API endpoint. Includes payload with image details and authentication headers. ```python import requests url = "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/operating-system" payload = { "name": "debian-12-amd64", "description": "Official Debian 12 for AMD/Intel", "siteIds": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], "imageUrl": "https://saimei.ftp.acc.umu.se/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2", "imageSha": "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae", "imageAuthType": "Bearer", "imageAuthToken": "acbd18db4cc2f85cedef654fccc4a4d8", "imageDisk": "/dev/sda", "rootFsId": "6c2ac315-3040-4728-94eb-b66d320206c1", "rootFsLabel": None, "phoneHomeEnabled": False, "userData": None, "allowOverride": False, "tenantId": "f97df110-f4de-492e-8849-4a6af68026b0", "isCloudInit": False } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ```