Skip to main content

attachments

Creates, updates, deletes, gets or lists an attachments resource.

Overview

Nameattachments
TypeResource
Idgoogle.artifactregistry.attachments

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe name of the attachment. E.g. projects/p1/locations/us/repositories/repo/attachments/sbom.
annotationsobjectOptional. 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.
attachmentNamespacestringThe namespace this attachment belongs to. E.g. If an attachment is created by artifact analysis, namespace is set to artifactanalysis.googleapis.com.
createTimestring (google-datetime)Output only. The time when the attachment was created.
filesarrayRequired. 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:.
ociVersionNamestringOutput 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.
targetstringRequired. 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.
typestringType of attachment. E.g. application/vnd.spdx+json
updateTimestring (google-datetime)Output only. The time when the attachment was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, repositoriesId, attachmentsIdGets an attachment.
listselectprojectsId, locationsId, repositoriesIdfilter, pageSize, pageTokenLists attachments.
createinsertprojectsId, locationsId, repositoriesIdattachmentIdCreates an attachment. The returned Operation will finish once the attachment has been created. Its response will be the created attachment.
deletedeleteprojectsId, locationsId, repositoriesId, attachmentsIdDeletes 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.

NameDatatypeDescription
attachmentsIdstring
locationsIdstring
projectsIdstring
repositoriesIdstring
attachmentIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

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;

INSERT examples

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
;

DELETE examples

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;