# Network › vRack › Attached services › Public Cloud API

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

> 4 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/network/vrack/attached-services/public-cloud/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/network/vrack/attached-services/public-cloud.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/network/vrack/attached-services/public-cloud.json?format=openapi3

## Operations

- `GET /vrack/{serviceName}/cloudProject` — List projects. Returns the identifiers of the Public Cloud projects attached to the vRack.
- `GET /vrack/{serviceName}/cloudProject/{project}` — Get a project. Returns the attached Public Cloud project and its vRack.
- `POST /vrack/{serviceName}/cloudProject` — Attach a project. Attaches a Public Cloud project to the vRack. Returns the task that performs it.
- `DELETE /vrack/{serviceName}/cloudProject/{project}` — Detach a project

## List projects. Returns the identifiers of the Public Cloud projects attached to the vRack.

`GET /1.0/vrack/{serviceName}/cloudProject`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/attached-services/public-cloud/#get-vrack-servicename-cloudproject

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:cloudProject/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your vrack |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string[] | successful operation |

```json
[
  "string"
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/vrack/{serviceName}/cloudProject" \
  -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("/vrack/{serviceName}/cloudProject")

# 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("/vrack/{serviceName}/cloudProject");

print_r($result);
?>
```

## Get a project. Returns the attached Public Cloud project and its vRack.

`GET /1.0/vrack/{serviceName}/cloudProject/{project}`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/attached-services/public-cloud/#get-vrack-servicename-cloudproject-project

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:cloudProject/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `project` | path | string | yes | publicCloud project |
| `serviceName` | path | string | yes | The internal name of your vrack |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | vrack.cloudProject | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `project` | string | read-only | publicCloud project |
| `vrack` | string | read-only | vrack name |

```json
{
  "project": "string",
  "vrack": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/vrack/{serviceName}/cloudProject/{project}" \
  -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("/vrack/{serviceName}/cloudProject/{project}")

# 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("/vrack/{serviceName}/cloudProject/{project}");

print_r($result);
?>
```

## Attach a project. Attaches a Public Cloud project to the vRack. Returns the task that performs it.

`POST /1.0/vrack/{serviceName}/cloudProject`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/attached-services/public-cloud/#post-vrack-servicename-cloudproject

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:cloudProject/attach`, `publicCloudProject:apiovh:vrack/attach`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your vrack |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `project` | string | yes | publicCloud project to add |

```json
{
  "project": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | vrack.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `function` | string | read-only |  |
| `id` | integer | read-only |  |
| `lastUpdate` | string (date-time) | read-only |  |
| `orderId` | integer | read-only |  |
| `serviceName` | string | read-only |  |
| `status` | vrack.TaskStatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `init`, `todo` |
| `targetDomain` | string | read-only |  |
| `todoDate` | string (date-time) | read-only |  |

```json
{
  "function": "string",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "orderId": 0,
  "serviceName": "string",
  "status": "cancelled",
  "targetDomain": "string",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/vrack/{serviceName}/cloudProject" \
  -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: string
result = client.post("/vrack/{serviceName}/cloudProject",
	project = None, # publicCloud project to add (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: string
$result = $ovh->post("/vrack/{serviceName}/cloudProject", array(
	project => null, // publicCloud project to add (type: string)
));

print_r($result);
?>
```

## Detach a project

`DELETE /1.0/vrack/{serviceName}/cloudProject/{project}`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/attached-services/public-cloud/#delete-vrack-servicename-cloudproject-project

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:cloudProject/detach`

Detach a project. Detaches the Public Cloud project from the vRack. Returns the task that performs it.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `project` | path | string | yes | publicCloud project |
| `serviceName` | path | string | yes | The internal name of your vrack |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | vrack.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `function` | string | read-only |  |
| `id` | integer | read-only |  |
| `lastUpdate` | string (date-time) | read-only |  |
| `orderId` | integer | read-only |  |
| `serviceName` | string | read-only |  |
| `status` | vrack.TaskStatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `init`, `todo` |
| `targetDomain` | string | read-only |  |
| `todoDate` | string (date-time) | read-only |  |

```json
{
  "function": "string",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "orderId": 0,
  "serviceName": "string",
  "status": "cancelled",
  "targetDomain": "string",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/vrack/{serviceName}/cloudProject/{project}" \
  -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.delete("/vrack/{serviceName}/cloudProject/{project}")

# 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->delete("/vrack/{serviceName}/cloudProject/{project}");

print_r($result);
?>
```
