client.storage covers the two volume types Namespace attaches to instances. Cache volumes are identified by a tag and reused across runs, with one generation per use. Persistent volumes are block volumes with their own identity and snapshots.
The examples on this page use a Compute client:
storage.listCacheVolumes()
Return every cache volume in the workspace.
Example
API reference
Arguments and options
The request has no fields. Pass an empty object.CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aListCacheVolumesResponse with cacheVolume, a list of CacheVolume. Each entry carries id, tag, metadata with the lifecycle timestamps, size, and state, and attachment with the instance the volume was attached to and its utilization.
storage.getCacheVolume()
Return a single cache volume generation by ID.
Example
API reference
Arguments and options
string
required
The unique identifier of the cache volume generation. A single tag can have multiple generations over time.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aGetCacheVolumeResponse with the matching cacheVolume.
storage.listVolumeTagSummaries()
Summarize every cache volume tag in the workspace. Use this to see cache usage per tag rather than per generation.
Example
API reference
Arguments and options
The request has no fields. Pass an empty object.CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aListVolumeTagSummariesResponse with summaries, a list of TagSummary. Each summary carries the tag, its requested sizeMb, and the generations that belong to it.
storage.getVolumeTagSummary()
Summarize a single cache volume tag.
Example
API reference
Arguments and options
string
required
The name of the cache volume tag.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aGetVolumeTagSummaryResponse with the matching TagSummary.
storage.destroyCacheVolume()
Release all cache volumes that belong to a tag.
Example
API reference
Arguments and options
string
required
The cache volume tag to release.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns an empty response. Omitting the tag fails withInvalidArgument, and an unknown tag fails with NotFound.
storage.listPersistentVolumes()
Return one page of persistent volumes, optionally filtered by tag and site.
Example
API reference
Arguments and options
string
Only return volumes with this tag. When omitted, all persistent volumes are returned.
StringMatcher
Only query the matching sites. When omitted, all sites are queried.
bigint
The maximum number of entries to return. The service may return fewer.
Uint8Array
The
paginationCursor from a previous response, to continue reading results.CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aListPersistentVolumesResponse with volumes and a paginationCursor. A set cursor means more results are available. Each PersistentVolume carries id, tag, sizeMb, site, createdAt, attachedTo, and the release and destruction timestamps.
storage.describePersistentVolume()
Return details of a single persistent volume.
Example
API reference
Arguments and options
string
required
The unique identifier of the persistent volume.
string
required
The tag of the persistent volume.
string
The site the volume is located in. When provided, only that site is queried.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aDescribePersistentVolumeResponse with the matching volume. If the volume does not exist, the call fails with NotFound.
storage.destroyPersistentVolumes()
Destroy every persistent volume that matches the given criteria.
Example
API reference
Arguments and options
At least one ofid or tag must be set. For safety the service rejects the IS_NOT operator.
StringMatcher
Matches volumes by ID.
StringMatcher
Matches volumes by tag.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aDestroyPersistentVolumesResponse with destroyedVolumes, the metadata of the volumes that were destroyed.
Omitting both matchers or using IS_NOT fails with InvalidArgument. When no volume matches, the call fails with NotFound.
storage.listPersistentVolumeSnapshots()
Return every snapshot of a persistent volume.
Example
API reference
Arguments and options
string
required
The unique identifier of the persistent volume.
string
required
The tag of the persistent volume.
string
The site the volume is located in. When provided, only that site is queried.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aListPersistentVolumeSnapshotsResponse with snapshots. Each PersistentVolumeSnapshot carries id, createdAt, usedBytes, netNewUsedBytes, the parent in snapshotFrom, and the attachment and release state.
storage.destroyPersistentVolumeSnapshot()
Mark a snapshot as abandoned. Abandoned snapshots are excluded when Namespace selects a base snapshot for new volumes, which is useful for skipping a corrupted snapshot without destroying the volume.
Example
API reference
Arguments and options
string
required
The unique identifier of the snapshot, which is the volume ID.
string
required
The tag of the persistent volume.
string
The site the volume is located in. When provided, only that site is queried.
CallOptions
Cancellation, timeout, and header options. See Shared call options.
Return value
Returns aDestroyPersistentVolumeSnapshotResponse with the abandoned snapshot.
If the snapshot does not exist, the call fails with NotFound. If it is still attached to an instance, the call fails with FailedPrecondition.
Related documentation
Storage platform
Cache volumes, artifact storage, and the container registry.
Volume usage
Report on cache and persistent volume storage.