> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/infra-controller/llms.txt.
> For full documentation content, see https://docs.nvidia.com/infra-controller/llms-full.txt.

# Update Site

PATCH https://carbide-rest-api.carbide.svc.cluster.local/v2/org/{org}/carbide/site/{siteId}
Content-Type: application/json

Update a specific Site

User must have `FORGE_PROVIDER_ADMIN` role.

Infrastructure Provider updating the Site must be the owner of the Site. At present, there are no Site specific configuration modifiable by Tenant.

Reference: https://docs.nvidia.com/infra-controller/infra-controller/rest-api-reference/api-reference/site/update-site

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: NCX Infra Controller REST API
  version: 1.0.0
paths:
  /v2/org/{org}/carbide/site/{siteId}:
    patch:
      operationId: update-site
      summary: Update Site
      description: >-
        Update a specific Site


        User must have `FORGE_PROVIDER_ADMIN` role.


        Infrastructure Provider updating the Site must be the owner of the Site.
        At present, there are no Site specific configuration modifiable by
        Tenant.
      tags:
        - subpackage_site
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
        - name: siteId
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: >-
            ```

            export JWT_BEARER_TOKEN="<jwt-bearer-token>"


            # Example org name: "acme-inc

            export ORG_NAME=<org-name>


            # Use the JWT bearer token in your API request auth header:

            curl -v -X GET -H "Content-Type: application/json" -H
            "Authorization: Bearer $JWT_BEARER_TOKEN"
            https://carbide-rest-api.carbide.svc.cluster.local/v2/org/$ORG_NAME/carbide/user/current

            ```
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Site'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteUpdateRequest'
servers:
  - url: https://carbide-rest-api.carbide.svc.cluster.local
components:
  schemas:
    SiteLocation:
      type: object
      properties:
        city:
          type: string
          description: City where the site is located
        state:
          type: string
          description: State where the site is located
        country:
          type: string
          description: Country where the site is located
      description: Location of the Site
      title: SiteLocation
    SiteContact:
      type: object
      properties:
        email:
          type: string
          description: Email address of the Site contact
      description: Contact for the Site
      title: SiteContact
    SiteUpdateRequest:
      type: object
      properties:
        name:
          type: string
          description: Update name of the Site. Can only be updated by Provider
        description:
          type: string
          description: Update description for the Site. Can only be updated by Provider
        renewRegistrationToken:
          type: boolean
          description: >-
            Set to true to issue a new registration token. Can only be updated
            by Provider
        serialConsoleHostname:
          type: string
          format: hostname
          description: >-
            Hostname to reach Serial Console for the Site. Can only be updated
            by Provider
        isSerialConsoleEnabled:
          type: boolean
          description: >-
            Enable/disable Serial Console. Can only be updated by Provider.
            Modifying this attribute has no actual effect on SOL. It will be
            removed in a future API version.
        serialConsoleIdleTimeout:
          type: integer
          description: >-
            Maximum idle time in seconds before Serial Console is disconnected.
            Can only be updated by Provider. Modifying this attribute has no
            actual effect on SOL. It will be removed in a future API version.
        serialConsoleMaxSessionLength:
          type: integer
          description: >-
            Maximum length of Serial Console session in seconds. Can only be
            updated by Provider. Modifying this attribute has no actual effect
            on SOL. It will be removed in a future API version.
        isSerialConsoleSSHKeysEnabled:
          type: boolean
          description: >-
            Enable/disable Serial Console access using SSH Keys. Previously
            updateable only by Tenants, modifying this value is no longer
            supported, update SSH Key Groups to remove Site instead.
        location:
          $ref: '#/components/schemas/SiteLocation'
        contact:
          $ref: '#/components/schemas/SiteContact'
      description: Request data to update a Site
      title: SiteUpdateRequest
    SiteStatus:
      type: string
      enum:
        - Pending
        - Registered
        - Error
      description: Status values for Site objects
      title: SiteStatus
    StatusDetail:
      type: object
      properties:
        status:
          type: string
        message:
          type: string
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
      description: Describes the details of a status transition for a resource
      title: StatusDetail
    SiteCapabilities:
      type: object
      properties:
        nativeNetworking:
          type: boolean
        networkSecurityGroup:
          type: boolean
        nvLinkPartition:
          type: boolean
        rackLevelAdministration:
          type: boolean
        imageBasedOperatingSystem:
          type: boolean
      description: Boolean flags to indicate features supported by a Site
      title: SiteCapabilities
    SiteMachineStatsByStatus:
      type: object
      properties:
        Decommissioned:
          type: integer
        Error:
          type: integer
        Initializing:
          type: integer
        InUse:
          type: integer
        Maintenance:
          type: integer
        Ready:
          type: integer
        Reset:
          type: integer
        Unknown:
          type: integer
      description: Machine stats for a Site by status
      title: SiteMachineStatsByStatus
    SiteMachineStatsByHealth:
      type: object
      properties:
        healthy:
          type: integer
        unhealthy:
          type: integer
      description: Machine stats for a Site by health
      title: SiteMachineStatsByHealth
    SiteMachineStatsByStatusAndHealth:
      type: object
      properties:
        Decommissioned:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
        Error:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
        Initializing:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
        InUse:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
        Maintenance:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
        Ready:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
        Reset:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
        Unknown:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
      description: Machine stats for a Site by status and health
      title: SiteMachineStatsByStatusAndHealth
    SiteMachineStatsByAllocation:
      type: object
      properties:
        allocatedInUse:
          type: integer
        allocatedNotInUse:
          type: integer
        unallocated:
          type: integer
      description: Machine stats for a Site by allocation
      title: SiteMachineStatsByAllocation
    SiteMachineStats:
      type: object
      properties:
        total:
          type: integer
        totalByStatus:
          $ref: '#/components/schemas/SiteMachineStatsByStatus'
        totalByHealth:
          $ref: '#/components/schemas/SiteMachineStatsByHealth'
        totalByStatusAndHealth:
          $ref: '#/components/schemas/SiteMachineStatsByStatusAndHealth'
        totalByAllocation:
          $ref: '#/components/schemas/SiteMachineStatsByAllocation'
      description: Machine stats for a Site
      title: SiteMachineStats
    Site:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          description: Name of the Site
        description:
          type: string
          description: Optional description for the Site
        org:
          type: string
        infrastructureProviderId:
          type: string
          format: uuid
        siteControllerVersion:
          type: string
          description: Version of the Site Controller software
        siteAgentVersion:
          type: string
          description: Version of the Site Agent software
        registrationToken:
          type: string
          description: >-
            Token that can be used to register a Site. Value only exposed to
            Provider
        registrationTokenExpiration:
          type: string
          format: date-time
          description: >-
            Date/time when registration token  expires. Value only exposed to
            Provider
        serialConsoleHostname:
          type: string
          format: hostname
        isSerialConsoleEnabled:
          type: boolean
          description: Indicates if Serial Console is enabled for the Site by the Provider
        serialConsoleIdleTimeout:
          type:
            - integer
            - 'null'
          description: Maximum idle time in seconds before Serial Console is disconnected
        serialConsoleMaxSessionLength:
          type:
            - integer
            - 'null'
          description: Maximum length of Serial Console session in seconds
        isSerialConsoleSSHKeysEnabled:
          type: boolean
          description: >-
            Only visible to Tenant retrieving the Site. Indicates if Serial
            Console access using SSH Keys is enabled by Tenant
        isOnline:
          type: boolean
          description: Indicates if the Site is currently reachable from Cloud
        status:
          $ref: '#/components/schemas/SiteStatus'
        statusHistory:
          type: array
          items:
            $ref: '#/components/schemas/StatusDetail'
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
        location:
          $ref: '#/components/schemas/SiteLocation'
        contact:
          $ref: '#/components/schemas/SiteContact'
        capabilities:
          $ref: '#/components/schemas/SiteCapabilities'
        machineStats:
          $ref: '#/components/schemas/SiteMachineStats'
      description: Site is a datacenter that is running NCX Infra Controller services
      title: Site
  securitySchemes:
    JWTBearerToken:
      type: http
      scheme: bearer
      description: >-
        ```

        export JWT_BEARER_TOKEN="<jwt-bearer-token>"


        # Example org name: "acme-inc

        export ORG_NAME=<org-name>


        # Use the JWT bearer token in your API request auth header:

        curl -v -X GET -H "Content-Type: application/json" -H "Authorization:
        Bearer $JWT_BEARER_TOKEN"
        https://carbide-rest-api.carbide.svc.cluster.local/v2/org/$ORG_NAME/carbide/user/current

        ```

```

## SDK Code Examples

```python example-2
import requests

url = "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId"

payload = {
    "contact": { "email": "janedoe@nvidia.com" },
    "isSerialConsoleSSHKeysEnabled": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript example-2
const url = 'https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"contact":{"email":"janedoe@nvidia.com"},"isSerialConsoleSSHKeysEnabled":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go example-2
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId"

	payload := strings.NewReader("{\n  \"contact\": {\n    \"email\": \"janedoe@nvidia.com\"\n  },\n  \"isSerialConsoleSSHKeysEnabled\": true\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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))

}
```

```ruby example-2
require 'uri'
require 'net/http'

url = URI("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"contact\": {\n    \"email\": \"janedoe@nvidia.com\"\n  },\n  \"isSerialConsoleSSHKeysEnabled\": true\n}"

response = http.request(request)
puts response.read_body
```

```java example-2
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"contact\": {\n    \"email\": \"janedoe@nvidia.com\"\n  },\n  \"isSerialConsoleSSHKeysEnabled\": true\n}")
  .asString();
```

```php example-2
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId', [
  'body' => '{
  "contact": {
    "email": "janedoe@nvidia.com"
  },
  "isSerialConsoleSSHKeysEnabled": true
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp example-2
using RestSharp;

var client = new RestClient("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"contact\": {\n    \"email\": \"janedoe@nvidia.com\"\n  },\n  \"isSerialConsoleSSHKeysEnabled\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift example-2
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "contact": ["email": "janedoe@nvidia.com"],
  "isSerialConsoleSSHKeysEnabled": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

```python
import requests

url = "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId"

payload = {
    "contact": { "email": "janedoe@nvidia.com" },
    "isSerialConsoleSSHKeysEnabled": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"contact":{"email":"janedoe@nvidia.com"},"isSerialConsoleSSHKeysEnabled":true}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId"

	payload := strings.NewReader("{\n  \"contact\": {\n    \"email\": \"janedoe@nvidia.com\"\n  },\n  \"isSerialConsoleSSHKeysEnabled\": true\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"contact\": {\n    \"email\": \"janedoe@nvidia.com\"\n  },\n  \"isSerialConsoleSSHKeysEnabled\": true\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"contact\": {\n    \"email\": \"janedoe@nvidia.com\"\n  },\n  \"isSerialConsoleSSHKeysEnabled\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId', [
  'body' => '{
  "contact": {
    "email": "janedoe@nvidia.com"
  },
  "isSerialConsoleSSHKeysEnabled": true
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"contact\": {\n    \"email\": \"janedoe@nvidia.com\"\n  },\n  \"isSerialConsoleSSHKeysEnabled\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "contact": ["email": "janedoe@nvidia.com"],
  "isSerialConsoleSSHKeysEnabled": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/site/siteId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```