Skip to main content

files

Creates, updates, deletes, gets or lists a files resource.

Overview

Namefiles
TypeResource
Idgoogle.artifactregistry.files

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe name of the file, for example: projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt. If the file ID part contains slashes, they are escaped.
annotationsobjectOptional. Client specified annotations.
createTimestring (google-datetime)Output only. The time when the File was created.
fetchTimestring (google-datetime)Output only. The time when the last attempt to refresh the file's data was made. Only set when the repository is remote.
hashesarrayThe hashes of the file content.
ownerstringThe name of the Package or Version that owns this file, if any.
sizeBytesstring (int64)The size of the File in bytes.
updateTimestring (google-datetime)Output only. The time when the File was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, repositoriesId, filesIdGets a file.
listselectprojectsId, locationsId, repositoriesIdfilter, pageSize, pageToken, orderByLists files.
patchupdateprojectsId, locationsId, repositoriesId, filesIdupdateMaskUpdates a file.
deletedeleteprojectsId, locationsId, repositoriesId, filesIdDeletes a file and all of its content. It is only allowed on generic repositories. The returned operation will complete once the file has been deleted.
downloadexecprojectsId, locationsId, repositoriesId, filesIdDownload a file.
uploadexecprojectsId, locationsId, repositoriesIdDirectly uploads a file to a repository. The returned Operation will complete once the resources are uploaded.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
filesIdstring
locationsIdstring
projectsIdstring
repositoriesIdstring
filterstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a file.

SELECT
name,
annotations,
createTime,
fetchTime,
hashes,
owner,
sizeBytes,
updateTime
FROM google.artifactregistry.files
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND filesId = '{{ filesId }}' -- required;

UPDATE examples

Updates a file.

UPDATE google.artifactregistry.files
SET
data__name = '{{ name }}',
data__sizeBytes = '{{ sizeBytes }}',
data__hashes = '{{ hashes }}',
data__owner = '{{ owner }}',
data__annotations = '{{ annotations }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND filesId = '{{ filesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
annotations,
createTime,
fetchTime,
hashes,
owner,
sizeBytes,
updateTime;

DELETE examples

Deletes a file and all of its content. It is only allowed on generic repositories. The returned operation will complete once the file has been deleted.

DELETE FROM google.artifactregistry.files
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND filesId = '{{ filesId }}' --required;

Lifecycle Methods

Download a file.

EXEC google.artifactregistry.files.download 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@repositoriesId='{{ repositoriesId }}' --required,
@filesId='{{ filesId }}' --required;