files
Creates, updates, deletes, gets or lists a files resource.
Overview
| Name | files |
| Type | Resource |
| Id | google.artifactregistry.files |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | The 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. |
annotations | object | Optional. Client specified annotations. |
createTime | string (google-datetime) | Output only. The time when the File was created. |
fetchTime | string (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. |
hashes | array | The hashes of the file content. |
owner | string | The name of the Package or Version that owns this file, if any. |
sizeBytes | string (int64) | The size of the File in bytes. |
updateTime | string (google-datetime) | Output only. The time when the File was last updated. |
| Name | Datatype | Description |
|---|---|---|
name | string | The 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. |
annotations | object | Optional. Client specified annotations. |
createTime | string (google-datetime) | Output only. The time when the File was created. |
fetchTime | string (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. |
hashes | array | The hashes of the file content. |
owner | string | The name of the Package or Version that owns this file, if any. |
sizeBytes | string (int64) | The size of the File in bytes. |
updateTime | string (google-datetime) | Output only. The time when the File was last updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | projectsId, locationsId, repositoriesId, filesId | Gets a file. | |
list | select | projectsId, locationsId, repositoriesId | pageToken, orderBy, filter, pageSize | Lists files. |
patch | update | projectsId, locationsId, repositoriesId, filesId | updateMask | Updates a file. |
delete | delete | projectsId, locationsId, repositoriesId, filesId | 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. | |
upload | exec | projectsId, locationsId, repositoriesId | Directly uploads a file to a repository. The returned Operation will complete once the resources are uploaded. | |
download | exec | projectsId, locationsId, repositoriesId, filesId | Download a file. |
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.
| Name | Datatype | Description |
|---|---|---|
filesId | string | |
locationsId | string | |
projectsId | string | |
repositoriesId | string | |
filter | string | |
orderBy | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT examples
- get
- list
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
;
Lists files.
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 pageToken = '{{ pageToken }}'
AND orderBy = '{{ orderBy }}'
AND filter = '{{ filter }}'
AND pageSize = '{{ pageSize }}'
;
UPDATE examples
- patch
Updates a file.
UPDATE google.artifactregistry.files
SET
data__annotations = '{{ annotations }}',
data__owner = '{{ owner }}',
data__hashes = '{{ hashes }}',
data__name = '{{ name }}',
data__sizeBytes = '{{ sizeBytes }}'
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
- delete
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
- upload
- download
Directly uploads a file to a repository. The returned Operation will complete once the resources are uploaded.
EXEC google.artifactregistry.files.upload
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@repositoriesId='{{ repositoriesId }}' --required
@@json=
'{
"fileId": "{{ fileId }}"
}'
;
Download a file.
EXEC google.artifactregistry.files.download
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@repositoriesId='{{ repositoriesId }}' --required,
@filesId='{{ filesId }}' --required
;