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
Successful response
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. |
Successful response
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 | filter , pageSize , pageToken , orderBy | 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. | |
download | exec | projectsId , locationsId , repositoriesId , filesId | Download a file. | |
upload | exec | projectsId , locationsId , repositoriesId | Directly 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.
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 filter = '{{ filter }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
AND orderBy = '{{ orderBy }}';
UPDATE
examples
- patch
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
- 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
- download
- upload
Download a file.
EXEC google.artifactregistry.files.download
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@repositoriesId='{{ repositoriesId }}' --required,
@filesId='{{ filesId }}' --required;
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 }}"
}';