# Public Cloud › Storage › File Storage API

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

> 5 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/public-cloud/storage/file-storage/

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

## Operations

- `GET /publicCloud/project/{projectId}/storage/file/share` — List file storages
- `GET /publicCloud/project/{projectId}/storage/file/share/{fileStorageId}` — Get a file storage
- `POST /publicCloud/project/{projectId}/storage/file/share` — Create a file storage
- `DELETE /publicCloud/project/{projectId}/storage/file/share/{fileStorageId}` — Delete a file storage
- `PUT /publicCloud/project/{projectId}/storage/file/share/{fileStorageId}` — Update a file storage

## List file storages

`GET /v2/publicCloud/project/{projectId}/storage/file/share`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/file-storage/#getShares

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:share/get`

Returns the file storages of the project.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.file.FileStorage[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the file storage |
| `currentState` | publicCloud.storage.file.FileStorageCurrentState | read-only | Current observed state of the file storage from the infrastructure |
| `currentState.capabilities` | publicCloud.storage.file.FileStorageCapability[] | read-only | Action availability flags derived from the file storage status |
| `currentState.capabilities[].enabled` | boolean | read-only | Whether the action is currently available on the file storage |
| `currentState.capabilities[].name` | publicCloud.storage.file.FileStorageCapabilityEnum | read-only | The action the flag refers to — one of `ACL_MANAGEMENT`, `DELETE`, `EDIT`, `REVERT_FROM_SNAPSHOT`, `SNAPSHOT_MANAGEMENT`, `UPDATE_SIZE` |
| `currentState.capabilities[].reason` | publicCloud.storage.file.FileStorageCapabilityReasonEnum | read-only | Why the action is unavailable. Set only when enabled is false. — one of `HAS_DEPENDENT_SNAPSHOTS`, `INVALID_STATUS` |
| `currentState.description` | string | read-only | File storage description |
| `currentState.encryption` | publicCloud.storage.file.FileStorageEncryption | read-only | Encryption configuration of the file storage |
| `currentState.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `currentState.exportLocations` | publicCloud.storage.file.FileStorageExportLocation[] | read-only | NFS export paths for mounting the file storage |
| `currentState.exportLocations[].path` | string | read-only | NFS export path for mounting |
| `currentState.exportLocations[].preferred` | boolean | read-only | Whether this is the preferred export location |
| `currentState.location` | publicCloud.common.Location | read-only | Current resource location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Current file storage name |
| `currentState.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | read-only | File sharing protocol — one of `NFS` |
| `currentState.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef | read-only | Reference to the share network the file storage is attached to |
| `currentState.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `currentState.shareType` | publicCloud.storage.file.FileStorageTypeEnum | read-only | File storage type (performance tier) — one of `STANDARD_1AZ` |
| `currentState.size` | integer | read-only | Current size of the file storage in GB |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the file storage |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the file storage |
| `resourceStatus` | common.ResourceStatusEnum | read-only | File storage readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.file.FileStorageTargetSpec | read-only | Last target specification of the file storage |
| `targetSpec.createFrom` | publicCloud.storage.file.FileStorageCreateFrom |  | Optional source to create the file storage from. Immutable after creation. When omitted, an empty file storage is created. |
| `targetSpec.createFrom.snapshotId` | string (uuid) | yes | Identifier of a file storage snapshot of the same project to create the file storage from. The snapshot must be available, otherwise the request is rejected with a 409, and must be in the region set in `location.region`. The file storage type and encryption are taken from the snapshot's source file storage. |
| `targetSpec.description` | string |  | Description of the file storage |
| `targetSpec.encryption` | publicCloud.storage.file.FileStorageEncryption |  | Encryption configuration for the file storage. Immutable after creation. When `createFrom` is set, the encryption of the snapshot's source file storage is used and returned here: requesting `enabled` true from a snapshot of an unencrypted file storage is rejected as an invalid parameter, and requesting `enabled` false from a snapshot of an encrypted file storage is ignored, so the new file storage is encrypted. |
| `targetSpec.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `targetSpec.location` | publicCloud.common.Location | yes | Desired resource location. When `createFrom` is set, `region` must be the region of the snapshot. |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired file storage name |
| `targetSpec.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | yes | File sharing protocol — one of `NFS` |
| `targetSpec.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef |  | Reference to a pre-existing share network to attach the file storage to. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the share network of the snapshot's source file storage is used and returned here. When sent, it must be that same share network, otherwise the request is rejected as an invalid parameter. |
| `targetSpec.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `targetSpec.shareType` | publicCloud.storage.file.FileStorageTypeEnum |  | File storage type (performance tier). Required when `createFrom` is not set. When `createFrom` is set, it is optional: the type of the snapshot's source file storage is used and returned here. — one of `STANDARD_1AZ` |
| `targetSpec.size` | integer |  | Size of the file storage in GB. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the size of the snapshot is used and returned here. A size smaller than the snapshot's size is rejected as an invalid parameter. |
| `updatedAt` | string (date-time) | read-only | Last update date of the file storage |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "capabilities": [
        {
          "enabled": true,
          "name": "ACL_MANAGEMENT",
          "reason": "HAS_DEPENDENT_SNAPSHOTS"
        }
      ],
      "description": "string",
      "encryption": {
        "enabled": true
      },
      "exportLocations": [
        {
          "path": "string",
          "preferred": true
        }
      ],
      "location": {
        "availabilityZone": "string",
        "region": "string"
      },
      "name": "string",
      "protocol": "NFS",
      "shareNetwork": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "shareType": "STANDARD_1AZ",
      "size": 0
    },
    "currentTasks": [
      {
        "errors": [
          {
            "message": "string"
          }
        ],
        "id": "00000000-0000-0000-0000-000000000000",
        "link": "string",
        "status": "ERROR",
        "type": "string"
      }
    ],
    "id": "00000000-0000-0000-0000-000000000000",
    "resourceStatus": "CREATING",
    "targetSpec": {
      "createFrom": {
        "snapshotId": "00000000-0000-0000-0000-000000000000"
      },
      "description": "string",
      "encryption": {
        "enabled": true
      },
      "location": {
        "availabilityZone": "string",
        "region": "string"
      },
      "name": "string",
      "protocol": "NFS",
      "shareNetwork": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "shareType": "STANDARD_1AZ",
      "size": 0
    },
  …
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/file/share" \
  -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/publicCloud/project/{projectId}/storage/file/share")

# 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/publicCloud/project/{projectId}/storage/file/share");

print_r($result);
?>
```

## Get a file storage

`GET /v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/file-storage/#getShare

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:share/get`

Returns the file storage configuration and its current state, including the NFS export paths to mount it.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `fileStorageId` | path | string (uuid) | yes | File storage ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.file.FileStorage | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the file storage |
| `currentState` | publicCloud.storage.file.FileStorageCurrentState | read-only | Current observed state of the file storage from the infrastructure |
| `currentState.capabilities` | publicCloud.storage.file.FileStorageCapability[] | read-only | Action availability flags derived from the file storage status |
| `currentState.capabilities[].enabled` | boolean | read-only | Whether the action is currently available on the file storage |
| `currentState.capabilities[].name` | publicCloud.storage.file.FileStorageCapabilityEnum | read-only | The action the flag refers to — one of `ACL_MANAGEMENT`, `DELETE`, `EDIT`, `REVERT_FROM_SNAPSHOT`, `SNAPSHOT_MANAGEMENT`, `UPDATE_SIZE` |
| `currentState.capabilities[].reason` | publicCloud.storage.file.FileStorageCapabilityReasonEnum | read-only | Why the action is unavailable. Set only when enabled is false. — one of `HAS_DEPENDENT_SNAPSHOTS`, `INVALID_STATUS` |
| `currentState.description` | string | read-only | File storage description |
| `currentState.encryption` | publicCloud.storage.file.FileStorageEncryption | read-only | Encryption configuration of the file storage |
| `currentState.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `currentState.exportLocations` | publicCloud.storage.file.FileStorageExportLocation[] | read-only | NFS export paths for mounting the file storage |
| `currentState.exportLocations[].path` | string | read-only | NFS export path for mounting |
| `currentState.exportLocations[].preferred` | boolean | read-only | Whether this is the preferred export location |
| `currentState.location` | publicCloud.common.Location | read-only | Current resource location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Current file storage name |
| `currentState.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | read-only | File sharing protocol — one of `NFS` |
| `currentState.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef | read-only | Reference to the share network the file storage is attached to |
| `currentState.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `currentState.shareType` | publicCloud.storage.file.FileStorageTypeEnum | read-only | File storage type (performance tier) — one of `STANDARD_1AZ` |
| `currentState.size` | integer | read-only | Current size of the file storage in GB |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the file storage |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the file storage |
| `resourceStatus` | common.ResourceStatusEnum | read-only | File storage readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.file.FileStorageTargetSpec | read-only | Last target specification of the file storage |
| `targetSpec.createFrom` | publicCloud.storage.file.FileStorageCreateFrom |  | Optional source to create the file storage from. Immutable after creation. When omitted, an empty file storage is created. |
| `targetSpec.createFrom.snapshotId` | string (uuid) | yes | Identifier of a file storage snapshot of the same project to create the file storage from. The snapshot must be available, otherwise the request is rejected with a 409, and must be in the region set in `location.region`. The file storage type and encryption are taken from the snapshot's source file storage. |
| `targetSpec.description` | string |  | Description of the file storage |
| `targetSpec.encryption` | publicCloud.storage.file.FileStorageEncryption |  | Encryption configuration for the file storage. Immutable after creation. When `createFrom` is set, the encryption of the snapshot's source file storage is used and returned here: requesting `enabled` true from a snapshot of an unencrypted file storage is rejected as an invalid parameter, and requesting `enabled` false from a snapshot of an encrypted file storage is ignored, so the new file storage is encrypted. |
| `targetSpec.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `targetSpec.location` | publicCloud.common.Location | yes | Desired resource location. When `createFrom` is set, `region` must be the region of the snapshot. |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired file storage name |
| `targetSpec.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | yes | File sharing protocol — one of `NFS` |
| `targetSpec.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef |  | Reference to a pre-existing share network to attach the file storage to. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the share network of the snapshot's source file storage is used and returned here. When sent, it must be that same share network, otherwise the request is rejected as an invalid parameter. |
| `targetSpec.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `targetSpec.shareType` | publicCloud.storage.file.FileStorageTypeEnum |  | File storage type (performance tier). Required when `createFrom` is not set. When `createFrom` is set, it is optional: the type of the snapshot's source file storage is used and returned here. — one of `STANDARD_1AZ` |
| `targetSpec.size` | integer |  | Size of the file storage in GB. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the size of the snapshot is used and returned here. A size smaller than the snapshot's size is rejected as an invalid parameter. |
| `updatedAt` | string (date-time) | read-only | Last update date of the file storage |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "capabilities": [
      {
        "enabled": true,
        "name": "ACL_MANAGEMENT",
        "reason": "HAS_DEPENDENT_SNAPSHOTS"
      }
    ],
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "exportLocations": [
      {
        "path": "string",
        "preferred": true
      }
    ],
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "createFrom": {
      "snapshotId": "00000000-0000-0000-0000-000000000000"
    },
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}" \
  -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/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}")

# 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/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}");

print_r($result);
?>
```

## Create a file storage

`POST /v2/publicCloud/project/{projectId}/storage/file/share`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/file-storage/#createShare

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:share/create`

Creates a file storage, either empty or from a snapshot.

Without `createFrom`, `shareType`, `shareNetwork` and `size` are required.

With `createFrom.snapshotId`, the file storage is created from that snapshot, which must belong to the same project and be in the region set in `location.region`. An unknown snapshot is rejected with a 404. The snapshot must be available: a snapshot in any other status is rejected with a 409. `shareType` and `encryption` are the values of the snapshot's source file storage and are returned in `targetSpec`: requesting `encryption.enabled` true from a snapshot of an unencrypted file storage is rejected as an invalid parameter, and requesting `encryption.enabled` false from a snapshot of an encrypted file storage is ignored. `size` is optional: when omitted, the snapshot's size is used and returned in `targetSpec`, and a size smaller than the snapshot's size is rejected. `shareNetwork` is optional: when omitted, the share network of the snapshot's source file storage is used and returned in `targetSpec`, and a different share network is rejected.

`createFrom` is set at creation only and cannot be changed afterward.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.storage.file.FileStorageCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.storage.file.FileStorageTargetSpec | yes | Desired target specification for the file storage |
| `targetSpec.createFrom` | publicCloud.storage.file.FileStorageCreateFrom |  | Optional source to create the file storage from. Immutable after creation. When omitted, an empty file storage is created. |
| `targetSpec.createFrom.snapshotId` | string (uuid) | yes | Identifier of a file storage snapshot of the same project to create the file storage from. The snapshot must be available, otherwise the request is rejected with a 409, and must be in the region set in `location.region`. The file storage type and encryption are taken from the snapshot's source file storage. |
| `targetSpec.description` | string |  | Description of the file storage |
| `targetSpec.encryption` | publicCloud.storage.file.FileStorageEncryption |  | Encryption configuration for the file storage. Immutable after creation. When `createFrom` is set, the encryption of the snapshot's source file storage is used and returned here: requesting `enabled` true from a snapshot of an unencrypted file storage is rejected as an invalid parameter, and requesting `enabled` false from a snapshot of an encrypted file storage is ignored, so the new file storage is encrypted. |
| `targetSpec.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `targetSpec.location` | publicCloud.common.Location | yes | Desired resource location. When `createFrom` is set, `region` must be the region of the snapshot. |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired file storage name |
| `targetSpec.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | yes | File sharing protocol — one of `NFS` |
| `targetSpec.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef |  | Reference to a pre-existing share network to attach the file storage to. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the share network of the snapshot's source file storage is used and returned here. When sent, it must be that same share network, otherwise the request is rejected as an invalid parameter. |
| `targetSpec.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `targetSpec.shareType` | publicCloud.storage.file.FileStorageTypeEnum |  | File storage type (performance tier). Required when `createFrom` is not set. When `createFrom` is set, it is optional: the type of the snapshot's source file storage is used and returned here. — one of `STANDARD_1AZ` |
| `targetSpec.size` | integer |  | Size of the file storage in GB. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the size of the snapshot is used and returned here. A size smaller than the snapshot's size is rejected as an invalid parameter. |

```json
{
  "targetSpec": {
    "createFrom": {
      "snapshotId": "00000000-0000-0000-0000-000000000000"
    },
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.file.FileStorage | successful operation |
| 400 | object | Error 400 response |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the file storage |
| `currentState` | publicCloud.storage.file.FileStorageCurrentState | read-only | Current observed state of the file storage from the infrastructure |
| `currentState.capabilities` | publicCloud.storage.file.FileStorageCapability[] | read-only | Action availability flags derived from the file storage status |
| `currentState.capabilities[].enabled` | boolean | read-only | Whether the action is currently available on the file storage |
| `currentState.capabilities[].name` | publicCloud.storage.file.FileStorageCapabilityEnum | read-only | The action the flag refers to — one of `ACL_MANAGEMENT`, `DELETE`, `EDIT`, `REVERT_FROM_SNAPSHOT`, `SNAPSHOT_MANAGEMENT`, `UPDATE_SIZE` |
| `currentState.capabilities[].reason` | publicCloud.storage.file.FileStorageCapabilityReasonEnum | read-only | Why the action is unavailable. Set only when enabled is false. — one of `HAS_DEPENDENT_SNAPSHOTS`, `INVALID_STATUS` |
| `currentState.description` | string | read-only | File storage description |
| `currentState.encryption` | publicCloud.storage.file.FileStorageEncryption | read-only | Encryption configuration of the file storage |
| `currentState.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `currentState.exportLocations` | publicCloud.storage.file.FileStorageExportLocation[] | read-only | NFS export paths for mounting the file storage |
| `currentState.exportLocations[].path` | string | read-only | NFS export path for mounting |
| `currentState.exportLocations[].preferred` | boolean | read-only | Whether this is the preferred export location |
| `currentState.location` | publicCloud.common.Location | read-only | Current resource location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Current file storage name |
| `currentState.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | read-only | File sharing protocol — one of `NFS` |
| `currentState.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef | read-only | Reference to the share network the file storage is attached to |
| `currentState.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `currentState.shareType` | publicCloud.storage.file.FileStorageTypeEnum | read-only | File storage type (performance tier) — one of `STANDARD_1AZ` |
| `currentState.size` | integer | read-only | Current size of the file storage in GB |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the file storage |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the file storage |
| `resourceStatus` | common.ResourceStatusEnum | read-only | File storage readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.file.FileStorageTargetSpec | read-only | Last target specification of the file storage |
| `targetSpec.createFrom` | publicCloud.storage.file.FileStorageCreateFrom |  | Optional source to create the file storage from. Immutable after creation. When omitted, an empty file storage is created. |
| `targetSpec.createFrom.snapshotId` | string (uuid) | yes | Identifier of a file storage snapshot of the same project to create the file storage from. The snapshot must be available, otherwise the request is rejected with a 409, and must be in the region set in `location.region`. The file storage type and encryption are taken from the snapshot's source file storage. |
| `targetSpec.description` | string |  | Description of the file storage |
| `targetSpec.encryption` | publicCloud.storage.file.FileStorageEncryption |  | Encryption configuration for the file storage. Immutable after creation. When `createFrom` is set, the encryption of the snapshot's source file storage is used and returned here: requesting `enabled` true from a snapshot of an unencrypted file storage is rejected as an invalid parameter, and requesting `enabled` false from a snapshot of an encrypted file storage is ignored, so the new file storage is encrypted. |
| `targetSpec.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `targetSpec.location` | publicCloud.common.Location | yes | Desired resource location. When `createFrom` is set, `region` must be the region of the snapshot. |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired file storage name |
| `targetSpec.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | yes | File sharing protocol — one of `NFS` |
| `targetSpec.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef |  | Reference to a pre-existing share network to attach the file storage to. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the share network of the snapshot's source file storage is used and returned here. When sent, it must be that same share network, otherwise the request is rejected as an invalid parameter. |
| `targetSpec.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `targetSpec.shareType` | publicCloud.storage.file.FileStorageTypeEnum |  | File storage type (performance tier). Required when `createFrom` is not set. When `createFrom` is set, it is optional: the type of the snapshot's source file storage is used and returned here. — one of `STANDARD_1AZ` |
| `targetSpec.size` | integer |  | Size of the file storage in GB. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the size of the snapshot is used and returned here. A size smaller than the snapshot's size is rejected as an invalid parameter. |
| `updatedAt` | string (date-time) | read-only | Last update date of the file storage |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "capabilities": [
      {
        "enabled": true,
        "name": "ACL_MANAGEMENT",
        "reason": "HAS_DEPENDENT_SNAPSHOTS"
      }
    ],
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "exportLocations": [
      {
        "path": "string",
        "preferred": true
      }
    ],
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "createFrom": {
      "snapshotId": "00000000-0000-0000-0000-000000000000"
    },
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/file/share" \
  -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: publicCloud.storage.file.FileStorageCreation
result = client.post("/v2/publicCloud/project/{projectId}/storage/file/share",
	targetSpec = None, # Desired target specification for the file storage (type: publicCloud.storage.file.FileStorageTargetSpec)
)

# 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: publicCloud.storage.file.FileStorageCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/storage/file/share", array(
	targetSpec => null, // Desired target specification for the file storage (type: publicCloud.storage.file.FileStorageTargetSpec)
));

print_r($result);
?>
```

## Delete a file storage

`DELETE /v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/file-storage/#deleteShare

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:share/delete`

Deletes the file storage. A file storage that still has snapshots cannot be deleted: delete them first.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `fileStorageId` | path | string (uuid) | yes | File storage ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.file.FileStorage | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the file storage |
| `currentState` | publicCloud.storage.file.FileStorageCurrentState | read-only | Current observed state of the file storage from the infrastructure |
| `currentState.capabilities` | publicCloud.storage.file.FileStorageCapability[] | read-only | Action availability flags derived from the file storage status |
| `currentState.capabilities[].enabled` | boolean | read-only | Whether the action is currently available on the file storage |
| `currentState.capabilities[].name` | publicCloud.storage.file.FileStorageCapabilityEnum | read-only | The action the flag refers to — one of `ACL_MANAGEMENT`, `DELETE`, `EDIT`, `REVERT_FROM_SNAPSHOT`, `SNAPSHOT_MANAGEMENT`, `UPDATE_SIZE` |
| `currentState.capabilities[].reason` | publicCloud.storage.file.FileStorageCapabilityReasonEnum | read-only | Why the action is unavailable. Set only when enabled is false. — one of `HAS_DEPENDENT_SNAPSHOTS`, `INVALID_STATUS` |
| `currentState.description` | string | read-only | File storage description |
| `currentState.encryption` | publicCloud.storage.file.FileStorageEncryption | read-only | Encryption configuration of the file storage |
| `currentState.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `currentState.exportLocations` | publicCloud.storage.file.FileStorageExportLocation[] | read-only | NFS export paths for mounting the file storage |
| `currentState.exportLocations[].path` | string | read-only | NFS export path for mounting |
| `currentState.exportLocations[].preferred` | boolean | read-only | Whether this is the preferred export location |
| `currentState.location` | publicCloud.common.Location | read-only | Current resource location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Current file storage name |
| `currentState.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | read-only | File sharing protocol — one of `NFS` |
| `currentState.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef | read-only | Reference to the share network the file storage is attached to |
| `currentState.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `currentState.shareType` | publicCloud.storage.file.FileStorageTypeEnum | read-only | File storage type (performance tier) — one of `STANDARD_1AZ` |
| `currentState.size` | integer | read-only | Current size of the file storage in GB |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the file storage |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the file storage |
| `resourceStatus` | common.ResourceStatusEnum | read-only | File storage readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.file.FileStorageTargetSpec | read-only | Last target specification of the file storage |
| `targetSpec.createFrom` | publicCloud.storage.file.FileStorageCreateFrom |  | Optional source to create the file storage from. Immutable after creation. When omitted, an empty file storage is created. |
| `targetSpec.createFrom.snapshotId` | string (uuid) | yes | Identifier of a file storage snapshot of the same project to create the file storage from. The snapshot must be available, otherwise the request is rejected with a 409, and must be in the region set in `location.region`. The file storage type and encryption are taken from the snapshot's source file storage. |
| `targetSpec.description` | string |  | Description of the file storage |
| `targetSpec.encryption` | publicCloud.storage.file.FileStorageEncryption |  | Encryption configuration for the file storage. Immutable after creation. When `createFrom` is set, the encryption of the snapshot's source file storage is used and returned here: requesting `enabled` true from a snapshot of an unencrypted file storage is rejected as an invalid parameter, and requesting `enabled` false from a snapshot of an encrypted file storage is ignored, so the new file storage is encrypted. |
| `targetSpec.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `targetSpec.location` | publicCloud.common.Location | yes | Desired resource location. When `createFrom` is set, `region` must be the region of the snapshot. |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired file storage name |
| `targetSpec.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | yes | File sharing protocol — one of `NFS` |
| `targetSpec.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef |  | Reference to a pre-existing share network to attach the file storage to. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the share network of the snapshot's source file storage is used and returned here. When sent, it must be that same share network, otherwise the request is rejected as an invalid parameter. |
| `targetSpec.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `targetSpec.shareType` | publicCloud.storage.file.FileStorageTypeEnum |  | File storage type (performance tier). Required when `createFrom` is not set. When `createFrom` is set, it is optional: the type of the snapshot's source file storage is used and returned here. — one of `STANDARD_1AZ` |
| `targetSpec.size` | integer |  | Size of the file storage in GB. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the size of the snapshot is used and returned here. A size smaller than the snapshot's size is rejected as an invalid parameter. |
| `updatedAt` | string (date-time) | read-only | Last update date of the file storage |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "capabilities": [
      {
        "enabled": true,
        "name": "ACL_MANAGEMENT",
        "reason": "HAS_DEPENDENT_SNAPSHOTS"
      }
    ],
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "exportLocations": [
      {
        "path": "string",
        "preferred": true
      }
    ],
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "createFrom": {
      "snapshotId": "00000000-0000-0000-0000-000000000000"
    },
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}" \
  -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("/v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}")

# 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("/v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}");

print_r($result);
?>
```

## Update a file storage

`PUT /v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/file-storage/#editShare

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:share/edit`

Replaces the file storage's target specification as a whole. The body carries the complete desired state of every field `publicCloud.storage.file.FileStorageUpdateTargetSpec` exposes (`description`, `name` and `size`), so read the file storage first and restate every value you want to keep: a field left out of `targetSpec` is cleared, not carried over from the stored specification. Leaving `description` out clears the description.

The create-only fields `protocol`, `shareType`, `shareNetwork`, `location`, `encryption` and `createFrom` cannot be changed once the file storage exists. They are deliberately absent from the update model, and sending one is rejected with a 400.

`name` and `size` are both required. `size` can only grow: restate the current size to keep it, or send a larger value to extend the file storage, because shrinking one is not supported.

The optional `checksum` guards against a lost update: when supplied it must match the file storage's current checksum or the request is rejected with a 409 checksum mismatch. Omitting it skips the check and forces the write (last-write-wins).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `fileStorageId` | path | string (uuid) | yes | File storage ID |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.storage.file.FileStorageUpdate`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string |  | Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). |
| `targetSpec` | publicCloud.storage.file.FileStorageUpdateTargetSpec | yes | Desired target specification for the file storage |
| `targetSpec.description` | string |  | Description of the file storage |
| `targetSpec.name` | string | yes | Desired file storage name |
| `targetSpec.size` | integer | yes | Size of the file storage in GB. The size can only be increased (extend). Shrinking a file storage is not supported. |

```json
{
  "checksum": "string",
  "targetSpec": {
    "description": "string",
    "name": "string",
    "size": 0
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.file.FileStorage | successful operation |
| 400 | object | Error 400 response |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the file storage |
| `currentState` | publicCloud.storage.file.FileStorageCurrentState | read-only | Current observed state of the file storage from the infrastructure |
| `currentState.capabilities` | publicCloud.storage.file.FileStorageCapability[] | read-only | Action availability flags derived from the file storage status |
| `currentState.capabilities[].enabled` | boolean | read-only | Whether the action is currently available on the file storage |
| `currentState.capabilities[].name` | publicCloud.storage.file.FileStorageCapabilityEnum | read-only | The action the flag refers to — one of `ACL_MANAGEMENT`, `DELETE`, `EDIT`, `REVERT_FROM_SNAPSHOT`, `SNAPSHOT_MANAGEMENT`, `UPDATE_SIZE` |
| `currentState.capabilities[].reason` | publicCloud.storage.file.FileStorageCapabilityReasonEnum | read-only | Why the action is unavailable. Set only when enabled is false. — one of `HAS_DEPENDENT_SNAPSHOTS`, `INVALID_STATUS` |
| `currentState.description` | string | read-only | File storage description |
| `currentState.encryption` | publicCloud.storage.file.FileStorageEncryption | read-only | Encryption configuration of the file storage |
| `currentState.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `currentState.exportLocations` | publicCloud.storage.file.FileStorageExportLocation[] | read-only | NFS export paths for mounting the file storage |
| `currentState.exportLocations[].path` | string | read-only | NFS export path for mounting |
| `currentState.exportLocations[].preferred` | boolean | read-only | Whether this is the preferred export location |
| `currentState.location` | publicCloud.common.Location | read-only | Current resource location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Current file storage name |
| `currentState.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | read-only | File sharing protocol — one of `NFS` |
| `currentState.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef | read-only | Reference to the share network the file storage is attached to |
| `currentState.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `currentState.shareType` | publicCloud.storage.file.FileStorageTypeEnum | read-only | File storage type (performance tier) — one of `STANDARD_1AZ` |
| `currentState.size` | integer | read-only | Current size of the file storage in GB |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the file storage |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the file storage |
| `resourceStatus` | common.ResourceStatusEnum | read-only | File storage readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.file.FileStorageTargetSpec | read-only | Last target specification of the file storage |
| `targetSpec.createFrom` | publicCloud.storage.file.FileStorageCreateFrom |  | Optional source to create the file storage from. Immutable after creation. When omitted, an empty file storage is created. |
| `targetSpec.createFrom.snapshotId` | string (uuid) | yes | Identifier of a file storage snapshot of the same project to create the file storage from. The snapshot must be available, otherwise the request is rejected with a 409, and must be in the region set in `location.region`. The file storage type and encryption are taken from the snapshot's source file storage. |
| `targetSpec.description` | string |  | Description of the file storage |
| `targetSpec.encryption` | publicCloud.storage.file.FileStorageEncryption |  | Encryption configuration for the file storage. Immutable after creation. When `createFrom` is set, the encryption of the snapshot's source file storage is used and returned here: requesting `enabled` true from a snapshot of an unencrypted file storage is rejected as an invalid parameter, and requesting `enabled` false from a snapshot of an encrypted file storage is ignored, so the new file storage is encrypted. |
| `targetSpec.encryption.enabled` | boolean | yes | Whether the file storage is encrypted at rest with LUKS |
| `targetSpec.location` | publicCloud.common.Location | yes | Desired resource location. When `createFrom` is set, `region` must be the region of the snapshot. |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired file storage name |
| `targetSpec.protocol` | publicCloud.storage.file.FileStorageProtocolEnum | yes | File sharing protocol — one of `NFS` |
| `targetSpec.shareNetwork` | publicCloud.storage.file.FileStorageShareNetworkRef |  | Reference to a pre-existing share network to attach the file storage to. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the share network of the snapshot's source file storage is used and returned here. When sent, it must be that same share network, otherwise the request is rejected as an invalid parameter. |
| `targetSpec.shareNetwork.id` | string (uuid) | yes | Identifier of the share network to attach the file storage to |
| `targetSpec.shareType` | publicCloud.storage.file.FileStorageTypeEnum |  | File storage type (performance tier). Required when `createFrom` is not set. When `createFrom` is set, it is optional: the type of the snapshot's source file storage is used and returned here. — one of `STANDARD_1AZ` |
| `targetSpec.size` | integer |  | Size of the file storage in GB. Required when `createFrom` is not set. When `createFrom` is set, it is optional: when omitted, the size of the snapshot is used and returned here. A size smaller than the snapshot's size is rejected as an invalid parameter. |
| `updatedAt` | string (date-time) | read-only | Last update date of the file storage |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "capabilities": [
      {
        "enabled": true,
        "name": "ACL_MANAGEMENT",
        "reason": "HAS_DEPENDENT_SNAPSHOTS"
      }
    ],
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "exportLocations": [
      {
        "path": "string",
        "preferred": true
      }
    ],
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "createFrom": {
      "snapshotId": "00000000-0000-0000-0000-000000000000"
    },
    "description": "string",
    "encryption": {
      "enabled": true
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "protocol": "NFS",
    "shareNetwork": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "shareType": "STANDARD_1AZ",
    "size": 0
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}" \
  -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: publicCloud.storage.file.FileStorageUpdate
result = client.put("/v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}",
	checksum = None, # Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)
	targetSpec = None, # Desired target specification for the file storage (type: publicCloud.storage.file.FileStorageUpdateTargetSpec)
)

# 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: publicCloud.storage.file.FileStorageUpdate
$result = $ovh->put("/v2/publicCloud/project/{projectId}/storage/file/share/{fileStorageId}", array(
	checksum => null, // Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)
	targetSpec => null, // Desired target specification for the file storage (type: publicCloud.storage.file.FileStorageUpdateTargetSpec)
));

print_r($result);
?>
```
