# Security › Anti-DDoS › Services API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Security product's sections: https://developers.eu.ovhcloud.com/reference/security/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 3 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/security/anti-ddos/services/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/security/anti-ddos/services.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/security/anti-ddos/services.json?format=openapi3

## Operations

- `GET /networkDefense/vac/resource` — List VAC resources
- `GET /networkDefense/vac/resource/{resourceName}` — Get a VAC resource
- `PUT /networkDefense/vac/resource/{resourceName}` — Rename a VAC resource

## List VAC resources

`GET /v2/networkDefense/vac/resource`

Link: https://developers.eu.ovhcloud.com/reference/security/anti-ddos/services/#get-networkdefense-vac-resource

**Status:** Stable production version  
**IAM actions:** `vac:apiovh:resource/get`

Returns the list of VAC DDoS protection resources within the account. Every resource groups policies, profile and sensitivity with target IP address prefixes in order to tune detection and mitigation rules.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `iamTags` | query | object |  | Filter resources on IAM tags |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | networkDefense.Vac.ResourceWithIAM[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createdAt` | string (date-time) | read-only | Date and time the resource was created |
| `iam` | iam.ResourceMetadata | read-only | IAM resource metadata |
| `iam.displayName` | string | read-only | Resource display name |
| `iam.id` | string (uuid) | read-only | Unique identifier of the resource |
| `iam.state` | iam.ResourceMetadata.StateEnum | read-only | Resource state — one of `EXPIRED`, `IN_CREATION`, `OK`, `SUSPENDED` |
| `iam.tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `iam.urn` | string | read-only | Unique resource name used in policies |
| `id` | string (uuid) | read-only | Unique identifier of the resource |
| `name` | string | read-only | Name you chose for the resource |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Current status of the resource. For a VAC resource this is only ever READY or DELETING. — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `updatedAt` | string (date-time) | read-only | Date and time the resource was last updated |

```json
[
  {
    "createdAt": "2024-01-01T12:00:00Z",
    "iam": {
      "displayName": "string",
      "id": "00000000-0000-0000-0000-000000000000",
      "state": "EXPIRED",
      "tags": {
        "key": "string"
      },
      "urn": "string"
    },
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "resourceStatus": "CREATING",
    "updatedAt": "2024-01-01T12:00:00Z"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/networkDefense/vac/resource" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/networkDefense/vac/resource")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/networkDefense/vac/resource");

print_r($result);
?>
```

## Get a VAC resource

`GET /v2/networkDefense/vac/resource/{resourceName}`

Link: https://developers.eu.ovhcloud.com/reference/security/anti-ddos/services/#get-networkdefense-vac-resource-resourcename

**Status:** Stable production version  
**IAM actions:** `vac:apiovh:resource/get`

Returns a VAC DDoS protection resource with its name, status and creation and update dates. The status is READY, or DELETING while the resource is being removed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `resourceName` | path | string (uuid) | yes | Resource name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | networkDefense.Vac.ResourceWithIAM | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createdAt` | string (date-time) | read-only | Date and time the resource was created |
| `iam` | iam.ResourceMetadata | read-only | IAM resource metadata |
| `iam.displayName` | string | read-only | Resource display name |
| `iam.id` | string (uuid) | read-only | Unique identifier of the resource |
| `iam.state` | iam.ResourceMetadata.StateEnum | read-only | Resource state — one of `EXPIRED`, `IN_CREATION`, `OK`, `SUSPENDED` |
| `iam.tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `iam.urn` | string | read-only | Unique resource name used in policies |
| `id` | string (uuid) | read-only | Unique identifier of the resource |
| `name` | string | read-only | Name you chose for the resource |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Current status of the resource. For a VAC resource this is only ever READY or DELETING. — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `updatedAt` | string (date-time) | read-only | Date and time the resource was last updated |

```json
{
  "createdAt": "2024-01-01T12:00:00Z",
  "iam": {
    "displayName": "string",
    "id": "00000000-0000-0000-0000-000000000000",
    "state": "EXPIRED",
    "tags": {
      "key": "string"
    },
    "urn": "string"
  },
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "resourceStatus": "CREATING",
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/networkDefense/vac/resource/{resourceName}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/networkDefense/vac/resource/{resourceName}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/networkDefense/vac/resource/{resourceName}");

print_r($result);
?>
```

## Rename a VAC resource

`PUT /v2/networkDefense/vac/resource/{resourceName}`

Link: https://developers.eu.ovhcloud.com/reference/security/anti-ddos/services/#put-networkdefense-vac-resource-resourcename

**Status:** Stable production version  
**IAM actions:** `vac:apiovh:resource/edit`

Changes the name of a VAC DDoS protection resource. No other field can be updated through this call.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `resourceName` | path | string (uuid) | yes | Resource name |

### Request body (required)

Type: `networkDefense.Vac.ResourceUpdate`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | New name for the resource |

```json
{
  "name": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | networkDefense.Vac.Resource | successful operation |
| 400 | object | Error 400 response |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createdAt` | string (date-time) | read-only | Date and time the resource was created |
| `id` | string (uuid) | read-only | Unique identifier of the resource |
| `name` | string | read-only | Name you chose for the resource |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Current status of the resource. For a VAC resource this is only ever READY or DELETING. — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `updatedAt` | string (date-time) | read-only | Date and time the resource was last updated |

```json
{
  "createdAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "resourceStatus": "CREATING",
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/networkDefense/vac/resource/{resourceName}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: networkDefense.Vac.ResourceUpdate
result = client.put("/v2/networkDefense/vac/resource/{resourceName}",
	name = None, # New name for the resource (type: string)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: networkDefense.Vac.ResourceUpdate
$result = $ovh->put("/v2/networkDefense/vac/resource/{resourceName}", array(
	name => null, // New name for the resource (type: string)
));

print_r($result);
?>
```
