attachments
Creates, updates, deletes, gets or lists an attachments resource.
Overview
| Name | attachments |
| Type | Resource |
| Id | google.artifactregistry.attachments |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the attachment. E.g. projects/p1/locations/us/repositories/repo/attachments/sbom. |
annotations | object | Optional. User annotations. These attributes can only be set and used by the user, and not by Artifact Registry. See https://google.aip.dev/128#annotations for more details such as format and size limitations. |
attachmentNamespace | string | The namespace this attachment belongs to. E.g. If an attachment is created by artifact analysis, namespace is set to artifactanalysis.googleapis.com. |
createTime | string (google-datetime) | Output only. The time when the attachment was created. |
files | array | Required. The files that belong to this attachment. If the file ID part contains slashes, they are escaped. E.g. projects/p1/locations/us-central1/repositories/repo1/files/sha:. |
ociVersionName | string | Output only. The name of the OCI version that this attachment created. Only populated for Docker attachments. E.g. projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1. |
target | string | Required. The target the attachment is for, can be a Version, Package or Repository. E.g. projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1. |
type | string | Type of attachment. E.g. application/vnd.spdx+json |
updateTime | string (google-datetime) | Output only. The time when the attachment was last updated. |
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the attachment. E.g. projects/p1/locations/us/repositories/repo/attachments/sbom. |
annotations | object | Optional. User annotations. These attributes can only be set and used by the user, and not by Artifact Registry. See https://google.aip.dev/128#annotations for more details such as format and size limitations. |
attachmentNamespace | string | The namespace this attachment belongs to. E.g. If an attachment is created by artifact analysis, namespace is set to artifactanalysis.googleapis.com. |
createTime | string (google-datetime) | Output only. The time when the attachment was created. |
files | array | Required. The files that belong to this attachment. If the file ID part contains slashes, they are escaped. E.g. projects/p1/locations/us-central1/repositories/repo1/files/sha:. |
ociVersionName | string | Output only. The name of the OCI version that this attachment created. Only populated for Docker attachments. E.g. projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1. |
target | string | Required. The target the attachment is for, can be a Version, Package or Repository. E.g. projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1. |
type | string | Type of attachment. E.g. application/vnd.spdx+json |
updateTime | string (google-datetime) | Output only. The time when the attachment 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, attachmentsId | Gets an attachment. | |
list | select | projectsId, locationsId, repositoriesId | filter, pageSize, pageToken | Lists attachments. |
create | insert | projectsId, locationsId, repositoriesId | attachmentId | Creates an attachment. The returned Operation will finish once the attachment has been created. Its response will be the created attachment. |
delete | delete | projectsId, locationsId, repositoriesId, attachmentsId | Deletes an attachment. The returned Operation will finish once the attachments has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response. |
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 |
|---|---|---|
attachmentsId | string | |
locationsId | string | |
projectsId | string | |
repositoriesId | string | |
attachmentId | string | |
filter | string | |
pageSize | integer (int32) | |
pageToken | string |
SELECT examples
- get
- list
Gets an attachment.
SELECT
name,
annotations,
attachmentNamespace,
createTime,
files,
ociVersionName,
target,
type,
updateTime
FROM google.artifactregistry.attachments
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND attachmentsId = '{{ attachmentsId }}' -- required
;
Lists attachments.
SELECT
name,
annotations,
attachmentNamespace,
createTime,
files,
ociVersionName,
target,
type,
updateTime
FROM google.artifactregistry.attachments
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND filter = '{{ filter }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;
INSERT examples
- create
- Manifest
Creates an attachment. The returned Operation will finish once the attachment has been created. Its response will be the created attachment.
INSERT INTO google.artifactregistry.attachments (
data__name,
data__target,
data__type,
data__attachmentNamespace,
data__annotations,
data__files,
projectsId,
locationsId,
repositoriesId,
attachmentId
)
SELECT
'{{ name }}',
'{{ target }}',
'{{ type }}',
'{{ attachmentNamespace }}',
'{{ annotations }}',
'{{ files }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ repositoriesId }}',
'{{ attachmentId }}'
RETURNING
name,
done,
error,
metadata,
response
;
# Description fields are for documentation purposes
- name: attachments
props:
- name: projectsId
value: string
description: Required parameter for the attachments resource.
- name: locationsId
value: string
description: Required parameter for the attachments resource.
- name: repositoriesId
value: string
description: Required parameter for the attachments resource.
- name: name
value: string
description: >
The name of the attachment. E.g. `projects/p1/locations/us/repositories/repo/attachments/sbom`.
- name: target
value: string
description: >
Required. The target the attachment is for, can be a Version, Package or Repository. E.g. `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`.
- name: type
value: string
description: >
Type of attachment. E.g. `application/vnd.spdx+json`
- name: attachmentNamespace
value: string
description: >
The namespace this attachment belongs to. E.g. If an attachment is created by artifact analysis, namespace is set to `artifactanalysis.googleapis.com`.
- name: annotations
value: object
description: >
Optional. User annotations. These attributes can only be set and used by the user, and not by Artifact Registry. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
- name: files
value: array
description: >
Required. The files that belong to this attachment. If the file ID part contains slashes, they are escaped. E.g. `projects/p1/locations/us-central1/repositories/repo1/files/sha:`.
- name: attachmentId
value: string
DELETE examples
- delete
Deletes an attachment. The returned Operation will finish once the attachments has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.
DELETE FROM google.artifactregistry.attachments
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND attachmentsId = '{{ attachmentsId }}' --required
;