> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/dsx-air/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/dsx-air/_mcp/server.

# air_sdk.endpoints.ztp_scripts

## Classes

| Name                                                                       | Description                                                                |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`ZTPScript`](#air_sdkendpointsztp_scriptsztpscript)                       | The ZTP (Zero Touch Provisioning) configuration of a simulation.           |
| [`ZTPScriptEndpointAPI`](#air_sdkendpointsztp_scriptsztpscriptendpointapi) | Create, retrieve, update, and delete the ZTP configuration of simulations. |

## Module Contents

```python
class air_sdk.endpoints.ztp_scripts.ZTPScript
```

**Bases**: `air_sdk.air_model.AirModel`

The ZTP (Zero Touch Provisioning) configuration of a simulation.

It holds one entry per OS type: a provisioning script for Cumulus and a ZTP
JSON object for NVOS. A simulation can configure either one, or both.

ZTPScript objects should not be created directly. Use
`simulation.create_ztp_script(...)` instead.

> **Note**
>
> When printed, the configured OS types are listed and `content` is truncated
> to 50 characters with newlines collapsed, to avoid flooding console/logs
> with large scripts. Access the full configuration via
> `ztp_script.ztp_configs`.

**Examples:**

```python
>>> # Configure Cumulus and NVOS
>>> ztp_script = simulation.create_ztp_script(
...     ztp_configs={
...         'cumulus': '#!/bin/bash\n# CUMULUS-AUTOPROVISIONING\necho Hi',
...         'nvos': {'ztp': {'01-image': {'uninstall': True}}},
...     }
... )

>>> # Read one OS type
>>> nvos_config = ztp_script.ztp_configs['nvos']

>>> # Replace the NVOS configuration; the Cumulus script is kept
>>> new_nvos_config = {'ztp': {'01-image': {'uninstall': False}}}
>>> ztp_script.update(ztp_configs={'nvos': new_nvos_config})

>>> # Remove the NVOS configuration only
>>> ztp_script.update(ztp_configs={'nvos': None})

>>> # Delete the whole configuration
>>> simulation.delete_ztp_script()
>>> print(simulation.ztp_script)
None
```

```python
created: datetime.datetime
```

When the configuration was created.

```python
modified: datetime.datetime
```

When the configuration was last modified.

```python
content: str | None
```

The Cumulus provisioning script, or None when Cumulus is not
configured.

```python
ztp_configs: ZTPConfigs | None
```

The configuration keyed by OS type: `cumulus` holds the
provisioning script and `nvos` the ZTP JSON object. Object keys are
returned sorted by name. None when the Air API does not support
per-OS ZTP configuration.

```python
simulation: Simulation
```

The simulation this configuration belongs to.

```python
get_model_api() -> type[ZTPScriptEndpointAPI]
```

Returns the respective `AirModelAPI` type for this model

```python
model_api: ZTPScriptEndpointAPI
```

The current model API instance.

```python
update(
    *,
    content: str = ...,
    ztp_configs: ZTPConfigs | ZTPConfigsUpdate | dict[str, Any] = ...
) -> None
```

Update this ZTP configuration.

Send either `content` or `ztp_configs`, not both. Only the OS types sent
are written; the others are kept. Each OS type sent replaces its whole
configuration, with nothing merged inside it: to change one NVOS
section, send the complete NVOS configuration. An OS type set to `None`
is removed; removing the last one needs `delete()`.

**Parameters:**

* `content` – The new Cumulus provisioning script.
* `ztp_configs` – The new configuration of each OS type sent, keyed by OS type: `cumulus` (the provisioning script) or `nvos` (the ZTP JSON object), or `None` to remove that OS type.

**Example:**

```python
>>> ztp_script = simulation.ztp_script
>>> content = '#!/bin/bash\n# CUMULUS-AUTOPROVISIONING\n'
>>> content += 'echo "Updated script"'
>>> ztp_script.update(content=content)

>>> nvos_config = {'ztp': {'01-image': {'uninstall': True}}}
>>> ztp_script.update(ztp_configs={'nvos': nvos_config})

>>> # Remove the NVOS configuration; the Cumulus script is kept
>>> ztp_script.update(ztp_configs={'nvos': None})
```

```python
delete() -> None
```

Delete this ZTP configuration, including every OS type.

After deletion, accessing `simulation.ztp_script` returns `None`. To
remove one OS type and keep the others, set it to `None` with `update()`.

**Example:**

```python
>>> ztp_script = simulation.ztp_script
>>> ztp_script.delete()
>>> print(simulation.ztp_script)
None
```

```python
class air_sdk.endpoints.ztp_scripts.ZTPScriptEndpointAPI
```

**Bases**: `air_sdk.air_model.BaseEndpointAPI[air_sdk.endpoints.ztp_scripts.ZTPScript]`

Create, retrieve, update, and delete the ZTP configuration of simulations.

A ZTP configuration can also be created during import or off of `Simulation`
objects.

`update()` and `patch()` here don't refresh a `simulation.ztp_script` read
earlier: use `simulation.update_ztp_script()`, or call
`simulation.clear_cached_property('ztp_script')` before reading it again.

**Examples:**

```python
>>> # Add a ZTP configuration
>>> ztp_script = api.ztp_scripts.create(
...     simulation=simulation,
...     content='#!/bin/bash\n# CUMULUS-AUTOPROVISIONING\necho "Hello!"',
... )

>>> # Get a ZTP configuration
>>> ztp_script = api.ztp_scripts.get(simulation=simulation)
>>> print(ztp_script.content)
#!/bin/bash
# CUMULUS-AUTOPROVISIONING
echo "Hello!"

>>> # Add an NVOS configuration; the Cumulus script is kept
>>> api.ztp_scripts.patch(
...     simulation=simulation,
...     ztp_configs={'nvos': {'ztp': {'01-image': {'uninstall': True}}}},
... )

>>> # Remove the NVOS configuration, then delete the rest
>>> api.ztp_scripts.patch(simulation=simulation, ztp_configs={'nvos': None})
>>> api.ztp_scripts.delete(simulation=simulation)
```

```python
API_PATH: str
```

```python
model: type[ZTPScript]
```

```python
create(
    *,
    simulation: Simulation | PrimaryKey,
    content: str = ...,
    ztp_configs: ZTPConfigs | dict[str, Any] = ...
) -> ZTPScript
```

Add a ZTP configuration to a simulation that has none.

Send either `content` or `ztp_configs`, not both. The simulation must be
in the `INACTIVE` state.

**Parameters:**

* `simulation` – The simulation object or simulation ID.
* `content` – The Cumulus provisioning script.
* `ztp_configs` – The configuration keyed by OS type: `cumulus` (the provisioning script) and/or `nvos` (the ZTP JSON object).

**Returns:**

The created ZTP configuration.

**Raises:**

* `AirUnexpectedResponse` – If the simulation already has a ZTP configuration; use `update()` to change it.

**Example:**

```python
>>> api.ztp_scripts.create(
...     simulation='simulation-uuid',
...     ztp_configs={'nvos': {'ztp': {'01-image': {'uninstall': True}}}},
... )
```

```python
get(
    *,
    simulation: Simulation | PrimaryKey
) -> ZTPScript
```

Get the ZTP configuration for the simulation if it exists.

**Parameters:**

* `simulation` – The simulation object or simulation ID.

**Returns:**

The ZTP configuration for the simulation.

**Raises:**

* `AirUnexpectedResponse` – If the simulation doesn't have a ZTP configuration.

**Example:**

```python
>>> # Using simulation object
>>> ztp_script = api.ztp_scripts.get(simulation=simulation)

>>> # Using simulation ID
>>> ztp_script = api.ztp_scripts.get(simulation='simulation-uuid')

>>> print(ztp_script.content)
#!/bin/bash
# CUMULUS-AUTOPROVISIONING
echo "Hello, world!"
```

```python
patch(
    *,
    simulation: Simulation | PrimaryKey,
    content: str = ...,
    ztp_configs: ZTPConfigs | ZTPConfigsUpdate | dict[str, Any] = ...
) -> ZTPScript
```

Update the ZTP configuration of a simulation.

Send either `content` or `ztp_configs`, not both. Only the OS types sent
are written; the others are kept. Each OS type sent replaces its whole
configuration, with nothing merged inside it: to change one NVOS
section, send the complete NVOS configuration. An OS type set to `None`
is removed; removing the last one needs `delete()`. The simulation must
be in the `INACTIVE` state.

**Parameters:**

* `simulation` – The simulation object or simulation ID.
* `content` – The new Cumulus provisioning script.
* `ztp_configs` – The new configuration of each OS type sent, keyed by OS type: `cumulus` (the provisioning script) or `nvos` (the ZTP JSON object), or `None` to remove that OS type.

**Returns:**

The updated ZTP configuration.

**Examples:**

```python
>>> # Using simulation object
>>> with open('ztp_script.sh', 'r') as f:
...     content = f.read()
>>> script = api.ztp_scripts.patch(simulation=simulation, content=content)

>>> # Using simulation ID
>>> api.ztp_scripts.patch(
...     simulation='simulation-uuid',
...     ztp_configs={'nvos': {'ztp': {'01-image': {'uninstall': True}}}},
... )
```

```python
update(
    *,
    simulation: Simulation | PrimaryKey,
    content: str = ...,
    ztp_configs: ZTPConfigs | ZTPConfigsUpdate | dict[str, Any] = ...
) -> ZTPScript
```

Update the ZTP configuration of a simulation.

This is an alias for `patch()` provided for consistency with other
endpoints.

**Parameters:**

* `simulation` – The simulation object or simulation ID.
* `content` – The new Cumulus provisioning script.
* `ztp_configs` – The new configuration of each OS type sent, keyed by OS type: `cumulus` (the provisioning script) or `nvos` (the ZTP JSON object), or `None` to remove that OS type.

**Returns:**

The updated ZTP configuration.

**Examples:**

```python
>>> # Using simulation object
>>> content = '#!/bin/bash\n# CUMULUS-AUTOPROVISIONING'
>>> api.ztp_scripts.update(simulation=simulation, content=content)

>>> # Using simulation ID
>>> api.ztp_scripts.update(
...     simulation='simulation-uuid',
...     ztp_configs={'nvos': {'ztp': {'01-image': {'uninstall': True}}}},
... )
```

```python
delete(
    *,
    simulation: Simulation | PrimaryKey
) -> None
```

Delete the ZTP configuration of a simulation, including every OS type.

After deletion, `simulation.ztp_script` returns `None`. To remove one OS
type and keep the others, set it to `None` with `update()`.

**Parameters:**

* `simulation` – The simulation object or simulation ID.

**Examples:**

```python
>>> # Using simulation object
>>> api.ztp_scripts.delete(simulation=simulation)

>>> # Using simulation ID
>>> api.ztp_scripts.delete(simulation='simulation-uuid')

>>> print(simulation.ztp_script)
None
```