# Storage Classes

storage class related operations

## Get all storageClasses from a cluster.

> this API is used by cluster versions < 2.20

```json
{"openapi":"3.0.3","info":{"title":"NVIDIA Run:ai","version":"2.22"},"tags":[{"name":"Storage Classes","description":"storage class related operations"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"responses":{"V1StorageClassNames":{"description":"Expected response to a valid request","content":{"application/json":{"schema":{"type":"object","properties":{"storageClasses":{"type":"array","items":{"type":"string"}}}}}}},"V1Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"V1NotFound":{"description":"The specified resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}},"schemas":{"V1Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/v1/k8s/clusters/{uuid}/storage-classes":{"get":{"summary":"Get all storageClasses from a cluster.","description":"this API is used by cluster versions < 2.20","deprecated":true,"operationId":"V1GetStorageClasses","tags":["Storage Classes"],"parameters":[{"name":"includeNone","in":"query","description":"Include runai-none storage class to be able to create PVCs without a storage class","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"$ref":"#/components/responses/V1StorageClassNames"},"401":{"$ref":"#/components/responses/V1Unauthorized"},"404":{"$ref":"#/components/responses/V1NotFound"},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}}}}
```

## GET /api/v1/storage-classes

> get a Storage Class/Classes for a given cluster

```json
{"openapi":"3.0.3","info":{"title":"NVIDIA Run:ai","version":"2.22"},"tags":[{"name":"Storage Classes","description":"storage class related operations"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"ClusterIdRequired":{"name":"clusterId","in":"query","description":"The id of the cluster","required":true,"schema":{"type":"string","format":"uuid"}},"nameFilter":{"name":"name","in":"query","description":"filter by name","schema":{"type":"string"},"required":false}},"schemas":{"StorageClasses1":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/StorageClass1"}}}},"StorageClass1":{"type":"object","required":["storage_class_name"],"properties":{"cluster_id":{"type":"string","format":"uuid","description":"Cluster ID which has sent the resource info"},"storage_class_name":{"type":"string","description":"Storage class name"},"Spec":{"type":"object","required":["is_default"],"properties":{"provisioner":{"type":"string","description":"The provisioner type (unique name)"},"allow_volume_expansion":{"type":"boolean","description":"Indicates whether the storage class allows volume expansion"},"is_default":{"type":"boolean","description":"Indicates whether the storage class is the default one"}}}}},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500InternalServerError":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/storage-classes":{"get":{"summary":"get a Storage Class/Classes for a given cluster","operationId":"getStorageClasses","tags":["Storage Classes"],"parameters":[{"$ref":"#/components/parameters/ClusterIdRequired"},{"$ref":"#/components/parameters/nameFilter"},{"name":"includeNone","in":"query","description":"Include runai-none storage class, which is used for static provisioning of PVC. In static provisioning storage is omitted.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Executed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageClasses1"}}}},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## GET /api/v2/storage-classes

> get a Storage Class/Classes for a given cluster

```json
{"openapi":"3.0.3","info":{"title":"NVIDIA Run:ai","version":"2.22"},"tags":[{"name":"Storage Classes","description":"storage class related operations"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"ClusterIdRequired":{"name":"clusterId","in":"query","description":"The id of the cluster","required":true,"schema":{"type":"string","format":"uuid"}},"nameFilter":{"name":"name","in":"query","description":"filter by name","schema":{"type":"string"},"required":false}},"schemas":{"StorageClassesV2":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/StorageClassV2"}}}},"StorageClassV2":{"type":"object","required":["clusterId","storageClassName","spec"],"properties":{"clusterId":{"type":"string","format":"uuid","description":"Cluster ID which has sent the resource info"},"storageClassName":{"type":"string","description":"Storage class name"},"spec":{"$ref":"#/components/schemas/StorageClassSpec"},"permissions":{"$ref":"#/components/schemas/StorageClassPermissions"},"customization":{"$ref":"#/components/schemas/StorageClassCustomization"}}},"StorageClassSpec":{"type":"object","required":["isDefault"],"properties":{"provisioner":{"type":"string","description":"The provisioner type (unique name)"},"allowVolumeExpansion":{"type":"boolean","description":"Indicates whether the storage class allows volume expansion"},"isDefault":{"type":"boolean","description":"Indicates whether the storage class is the default one"}}},"StorageClassPermissions":{"type":"object","nullable":true,"properties":{"allowedForAssets":{"$ref":"#/components/schemas/AllowedForAssets"},"allowedForWorkloads":{"$ref":"#/components/schemas/AllowedForWorkloads"},"allowedForEphemeralVolumes":{"$ref":"#/components/schemas/AllowedForEphemeralVolumes"},"allowedForPersistentVolumes":{"$ref":"#/components/schemas/AllowedForPersistentVolumes"},"allowDataSharing":{"$ref":"#/components/schemas/AllowDataSharing"}}},"AllowedForAssets":{"type":"boolean","nullable":true,"description":"Permission to create PVC assets on this storage class."},"AllowedForWorkloads":{"type":"boolean","nullable":true,"description":"Permission to include PVCs that use this storage class in workloads. With this permission flag set to off, user will not be able to (a) include non-existing PVC asset, created on this storage class, in asset based submission. (b) include PVC instance with existing=false, that uses this storage class."},"AllowedForEphemeralVolumes":{"type":"boolean","nullable":true,"description":"Permission to allow workload to create ephemeral volumes on this storage class With this permission flag set to off, user will not be able to (a) create PVC asset with autoDelete=true and ephemeral=true (b) include PVC instance with isEphemeral=false, that uses this storage class."},"AllowedForPersistentVolumes":{"type":"boolean","nullable":true,"description":"Permission to allow workload to create persistent volumes on this storage class With this permission flag set to off, user will not be able to (a) create PVC asset with autoDelete=true and ephemeral=true (b) include PVC instance with isEphemeral=false, that uses this storage class."},"AllowDataSharing":{"type":"boolean","nullable":true,"description":"Permission to create a PVC using a shared volume"},"StorageClassCustomization":{"properties":{"accessMode":{"$ref":"#/components/schemas/AccessModeCustomization"},"volumeMode":{"$ref":"#/components/schemas/VolumeModeCustomization"},"claimSize":{"$ref":"#/components/schemas/ClaimSizeCustomization"},"attributes":{"$ref":"#/components/schemas/AttributesCustomization"}},"type":"object","nullable":true},"AccessModeCustomization":{"properties":{"required":{"type":"boolean","description":"whether accessModes field is mandatory","nullable":true},"default":{"$ref":"#/components/schemas/PvcAccessModes"},"supportedValues":{"$ref":"#/components/schemas/PvcSupportedAccessModes"}},"type":"object","nullable":true},"PvcAccessModes":{"description":"Requested access mode(s) for the newly created PVC.","properties":{"readWriteOnce":{"description":"Requesting claim that can be mounted in read/write mode to exactly one host. This is the default access mode.","type":"boolean","default":true,"nullable":true},"readOnlyMany":{"description":"Requesting claim that can be mounted in read-only mode to many hosts.","type":"boolean","default":false,"nullable":true},"readWriteMany":{"description":"Requesting claim that can be mounted in read/write mode to many hosts.","type":"boolean","default":false,"nullable":true}},"nullable":true,"type":"object"},"PvcSupportedAccessModes":{"description":"Supported access modes for a given storage class","properties":{"readWriteOnce":{"description":"Whether readWriteOnce access mode is supported for a given storage class","type":"boolean","default":true,"nullable":true},"readOnlyMany":{"description":"Whether readOnlyMany access mode is supported for a given storage class","type":"boolean","default":true,"nullable":true},"readWriteMany":{"description":"Whether readWriteMany access mode is supported for a given storage class","type":"boolean","default":true,"nullable":true}},"nullable":true,"type":"object"},"VolumeModeCustomization":{"properties":{"required":{"type":"boolean","description":"whether volumeMode field is mandatory","nullable":true},"default":{"$ref":"#/components/schemas/PvcVolumeMode"},"supportedValues":{"type":"object","nullable":true,"properties":{"filesystem":{"type":"boolean","description":"whether filesystem is supported","default":true,"nullable":true},"block":{"type":"boolean","description":"whether block is supported","default":true,"nullable":true}}}},"type":"object","nullable":true},"PvcVolumeMode":{"description":"The volume mode required by the claim. Choose Filesystem (default) or Block.","type":"string","enum":["Filesystem","Block"],"nullable":true},"ClaimSizeCustomization":{"properties":{"default":{"$ref":"#/components/schemas/PvcClaimSize"},"supportedUnits":{"type":"array","items":{"type":"string","enum":["MB","MiB","GB","GiB","TB","TiB"]}},"min":{"$ref":"#/components/schemas/PvcClaimSize"},"max":{"$ref":"#/components/schemas/PvcClaimSize"},"step":{"$ref":"#/components/schemas/PvcClaimSize"}},"type":"object","nullable":true},"PvcClaimSize":{"description":"Requested size for the PVC. Mandatory when existingPvc is false. Recommended sizes: TB/GB/MB/TIB/GIB/MIB","type":"string","pattern":"^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$","nullable":true},"AttributesCustomization":{"description":"added attributes that needs to be populated to any PVC created under this storage class.","type":"array","items":{"$ref":"#/components/schemas/PvcAddedAttribute"}},"PvcAddedAttribute":{"description":"Attribute that is added to any PVC of a given storage class.","required":["key"],"properties":{"key":{"type":"string","minLength":1,"description":"the PVC annotation to receive the value of this attribute. must be aligned with the rules of a name part of an annotation key, i.e. required, 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.","maxLength":63,"pattern":"^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$"},"format":{"$ref":"#/components/schemas/PvcAddedAttributeFormat"},"display":{"type":"string","minLength":1,"description":"a user friendly name describing the attribute","nullable":true},"description":{"type":"string","minLength":1,"description":"textual explanation of the attribute","nullable":true},"placeholder":{"type":"string","minLength":1,"description":"hint for the value that the attribute can hold. can be used as watermark in frontend fields or in help messages","nullable":true},"required":{"description":"whether the attribute is mandatory","type":"boolean","nullable":true},"defaultValue":{"description":"the default value for the attribute","type":"string","minLength":1,"nullable":true},"validationRegexp":{"description":"for text format, optional regex to validate the provided text","type":"string","minLength":1,"nullable":true},"minValue":{"description":"for number format, optional minimum value that can be provided","type":"number","minLength":1,"nullable":true},"maxValue":{"description":"for number format, optional maximum value that can be provided","type":"number","minLength":1,"nullable":true},"step":{"description":"for number format, required gap between permitted value","type":"number","minLength":1,"nullable":true},"validationError":{"description":"optional text for validation error. if not provided, default error text will be composed.","type":"string","minLength":1,"nullable":true}},"nullable":true,"type":"object"},"PvcAddedAttributeFormat":{"type":"string","description":"the values that the attribute can hold","enum":["text","number","boolean"],"nullable":true},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500InternalServerError":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v2/storage-classes":{"get":{"summary":"get a Storage Class/Classes for a given cluster","operationId":"getStorageClassesV2","tags":["Storage Classes"],"parameters":[{"$ref":"#/components/parameters/ClusterIdRequired"},{"$ref":"#/components/parameters/nameFilter"},{"name":"includeNone","in":"query","description":"Include runai-none storage class, which is used for static provisioning of PVC. In static provisioning storage is omitted.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Executed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageClassesV2"}}}},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```
