Categorygithub.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry
modulepackage
0.2.2
Repository: https://github.com/azure/azure-sdk-for-go.git
Documentation: pkg.go.dev

# README

Azure Container Registry client module for Go

Azure Container Registry allows you to store and manage container images and artifacts in a private registry for all types of container deployments.

Use the client library for Azure Container Registry to:

  • List images or artifacts in a registry
  • Obtain metadata for images and artifacts, repositories and tags
  • Set read/write/delete properties on registry items
  • Delete images and artifacts, repositories and tags
  • Upload and download images

Source code | Package (pkg.go.dev) | REST API documentation | Product documentation

Getting started

Install packages

Install azcontainerregistry and azidentity with go get:

go get github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry
go get github.com/Azure/azure-sdk-for-go/sdk/azidentity

azidentity is used for Azure Active Directory authentication as demonstrated below.

Prerequisites

To create a new Container Registry, you can use the Azure Portal, Azure PowerShell, or the Azure CLI. Here's an example using the Azure CLI:

az acr create --name MyContainerRegistry --resource-group MyResourceGroup --location westus --sku Basic

Authentication

This document demonstrates using azidentity.NewDefaultAzureCredential to authenticate. This credential type works in both local development and production environments. We recommend using a managed identity in production.

Client and BlobClient accepts any [azidentity][https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity] credential. See the azidentity documentation for more information about other credential types.

Create a client

Constructing the client requires your Container Registry's endpoint URL, which you can get from the Azure CLI (loginServer value returned by az acr list) or the Azure Portal (Login server value on registry overview page).

import (
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}

	client, err := azcontainerregistry.NewClient("<your Container Registry's endpoint URL>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
}

Key concepts

A registry stores Docker images and OCI Artifacts. An image or artifact consists of a manifest and layers. An image's manifest describes the layers that make up the image, and is uniquely identified by its digest. An image can also be "tagged" to give it a human-readable alias. An image or artifact can have zero or more tags associated with it, and each tag uniquely identifies the image. A collection of images that share the same name but have different tags, is referred to as a repository.

For more information please see Container Registry Concepts.

Examples

Get started with our examples.

Troubleshooting

For information about troubleshooting, refer to the troubleshooting guide.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct][https://opensource.microsoft.com/codeofconduct/]. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

# Functions

NewAuthenticationClient creates a new instance of AuthenticationClient with the specified values.
NewBlobClient creates a new instance of BlobClient with the specified values.
NewBlobDigestCalculator creates a new calculator to help to calculate blob digest when uploading blob.
NewClient creates a new instance of Client with the specified values.
NewDigestValidationReader creates a new reader that help you to validate digest when you read manifest or blob data.
PossibleArtifactArchitectureValues returns the possible values for the ArtifactArchitecture const type.
PossibleArtifactManifestOrderByValues returns the possible values for the ArtifactManifestOrderBy const type.
PossibleArtifactOperatingSystemValues returns the possible values for the ArtifactOperatingSystem const type.
PossibleArtifactTagOrderByValues returns the possible values for the ArtifactTagOrderBy const type.
PossibleContentTypeValues returns the possible values for the ContentType const type.
PossiblePostContentSchemaGrantTypeValues returns the possible values for the PostContentSchemaGrantType const type.
PossibleTokenGrantTypeValues returns the possible values for the TokenGrantType const type.

# Constants

ArtifactArchitectureAmd64 - AMD64.
ArtifactArchitectureArm - ARM.
ArtifactArchitectureArm64 - ARM64.
ArtifactArchitectureI386 - i386.
ArtifactArchitectureMips - MIPS.
ArtifactArchitectureMips64 - MIPS64.
ArtifactArchitectureMips64Le - MIPS64LE.
ArtifactArchitectureMipsLe - MIPSLE.
ArtifactArchitecturePpc64 - PPC64.
ArtifactArchitecturePpc64Le - PPC64LE.
ArtifactArchitectureRiscV64 - RISCv64.
ArtifactArchitectureS390X - s390x.
ArtifactArchitectureWasm - Wasm.
ArtifactManifestOrderByLastUpdatedOnAscending - Order manifest by LastUpdatedOn field, from least recently updated to most recently updated.
ArtifactManifestOrderByLastUpdatedOnDescending - Order manifests by LastUpdatedOn field, from most recently updated to least recently updated.
ArtifactManifestOrderByNone - Do not provide an orderby value in the request.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ArtifactTagOrderByLastUpdatedOnAscending - Order tags by LastUpdatedOn field, from least recently updated to most recently updated.
ArtifactTagOrderByLastUpdatedOnDescending - Order tags by LastUpdatedOn field, from most recently updated to least recently updated.
ArtifactTagOrderByNone - Do not provide an orderby value in the request.
ContentTypeApplicationVndDockerDistributionManifestV2JSON - Content Type 'application/vnd.docker.distribution.manifest.v2+json'.
ContentTypeApplicationVndOciImageManifestV1JSON - Content Type 'application/vnd.oci.image.manifest.v1+json'.
No description provided by the author
No description provided by the author
No description provided by the author
ServiceName is the cloud service name for Azure Container Registry.
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author

# Structs

ACRAccessToken - The ACR access token response.
ACRRefreshToken - The ACR refresh token response.
ArtifactManifestPlatform - The artifact's platform, consisting of operating system and architecture.
ArtifactManifestProperties - Manifest attributes details.
ArtifactTagProperties - Tag attributes.
AuthenticationClient contains the methods for the Authentication group.
AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenOptions contains the optional parameters for the AuthenticationClient.ExchangeAADAccessTokenForACRRefreshToken method.
AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenResponse contains the response from method AuthenticationClient.ExchangeAADAccessTokenForACRRefreshToken.
AuthenticationClientExchangeACRRefreshTokenForACRAccessTokenOptions contains the optional parameters for the AuthenticationClient.ExchangeACRRefreshTokenForACRAccessToken method.
AuthenticationClientExchangeACRRefreshTokenForACRAccessTokenResponse contains the response from method AuthenticationClient.ExchangeACRRefreshTokenForACRAccessToken.
AuthenticationClientOptions contains the optional parameters for the NewAuthenticationClient method.
BlobClient contains the methods for the ContainerRegistryBlob group.
BlobClientCancelUploadOptions contains the optional parameters for the BlobClient.CancelUpload method.
BlobClientCancelUploadResponse contains the response from method BlobClient.CancelUpload.
BlobClientCheckBlobExistsOptions contains the optional parameters for the BlobClient.CheckBlobExists method.
BlobClientCheckBlobExistsResponse contains the response from method BlobClient.CheckBlobExists.
BlobClientCheckChunkExistsOptions contains the optional parameters for the BlobClient.CheckChunkExists method.
BlobClientCheckChunkExistsResponse contains the response from method BlobClient.CheckChunkExists.
BlobClientCompleteUploadOptions contains the optional parameters for the BlobClient.CompleteUpload method.
BlobClientCompleteUploadResponse contains the response from method BlobClient.CompleteUpload.
BlobClientDeleteBlobOptions contains the optional parameters for the BlobClient.DeleteBlob method.
BlobClientDeleteBlobResponse contains the response from method BlobClient.DeleteBlob.
BlobClientGetBlobOptions contains the optional parameters for the BlobClient.GetBlob method.
BlobClientGetBlobResponse contains the response from method BlobClient.GetBlob.
BlobClientGetChunkOptions contains the optional parameters for the BlobClient.GetChunk method.
BlobClientGetChunkResponse contains the response from method BlobClient.GetChunk.
BlobClientGetUploadStatusOptions contains the optional parameters for the BlobClient.GetUploadStatus method.
BlobClientGetUploadStatusResponse contains the response from method BlobClient.GetUploadStatus.
BlobClientMountBlobOptions contains the optional parameters for the BlobClient.MountBlob method.
BlobClientMountBlobResponse contains the response from method BlobClient.MountBlob.
BlobClientOptions contains the optional parameters for the NewBlobClient method.
BlobClientStartUploadOptions contains the optional parameters for the BlobClient.StartUpload method.
BlobClientStartUploadResponse contains the response from method BlobClient.StartUpload.
BlobClientUploadChunkOptions contains the optional parameters for the BlobClient.UploadChunk method.
BlobClientUploadChunkResponse contains the response from method BlobClient.UploadChunk.
BlobDigestCalculator help to calculate blob digest when uploading blob.
Client contains the methods for the ContainerRegistry group.
ClientDeleteManifestOptions contains the optional parameters for the Client.DeleteManifest method.
ClientDeleteManifestResponse contains the response from method Client.DeleteManifest.
ClientDeleteRepositoryOptions contains the optional parameters for the Client.DeleteRepository method.
ClientDeleteRepositoryResponse contains the response from method Client.DeleteRepository.
ClientDeleteTagOptions contains the optional parameters for the Client.DeleteTag method.
ClientDeleteTagResponse contains the response from method Client.DeleteTag.
ClientGetManifestOptions contains the optional parameters for the Client.GetManifest method.
ClientGetManifestPropertiesOptions contains the optional parameters for the Client.GetManifestProperties method.
ClientGetManifestPropertiesResponse contains the response from method Client.GetManifestProperties.
ClientGetManifestResponse contains the response from method Client.GetManifest.
ClientGetRepositoryPropertiesOptions contains the optional parameters for the Client.GetRepositoryProperties method.
ClientGetRepositoryPropertiesResponse contains the response from method Client.GetRepositoryProperties.
ClientGetTagPropertiesOptions contains the optional parameters for the Client.GetTagProperties method.
ClientGetTagPropertiesResponse contains the response from method Client.GetTagProperties.
ClientListManifestsOptions contains the optional parameters for the Client.NewListManifestsPager method.
ClientListManifestsResponse contains the response from method Client.NewListManifestsPager.
ClientListRepositoriesOptions contains the optional parameters for the Client.NewListRepositoriesPager method.
ClientListRepositoriesResponse contains the response from method Client.NewListRepositoriesPager.
ClientListTagsOptions contains the optional parameters for the Client.NewListTagsPager method.
ClientListTagsResponse contains the response from method Client.NewListTagsPager.
ClientOptions contains the optional parameters for the NewClient method.
ClientUpdateManifestPropertiesOptions contains the optional parameters for the Client.UpdateManifestProperties method.
ClientUpdateManifestPropertiesResponse contains the response from method Client.UpdateManifestProperties.
ClientUpdateRepositoryPropertiesOptions contains the optional parameters for the Client.UpdateRepositoryProperties method.
ClientUpdateRepositoryPropertiesResponse contains the response from method Client.UpdateRepositoryProperties.
ClientUpdateTagPropertiesOptions contains the optional parameters for the Client.UpdateTagProperties method.
ClientUpdateTagPropertiesResponse contains the response from method Client.UpdateTagProperties.
ClientUploadManifestOptions contains the optional parameters for the Client.UploadManifest method.
ClientUploadManifestResponse contains the response from method Client.UploadManifest.
ContainerRepositoryProperties - Properties of this repository.
DigestValidationReader help to validate digest when fetching manifest or blob.
ManifestAttributes - Manifest details.
Manifests - Manifest attributes.
ManifestWriteableProperties - Changeable attributes.
Repositories - List of repositories.
RepositoryWriteableProperties - Changeable attributes for Repository.
TagAttributes - Tag attribute details.
TagList - List of tag details.
TagWriteableProperties - Changeable attributes.

# Type aliases

ArtifactArchitecture - The artifact platform's architecture.
ArtifactManifestOrderBy - Sort options for ordering manifests in a collection.
ArtifactOperatingSystem - The artifact platform's operating system.
ArtifactTagOrderBy - Sort options for ordering tags in a collection.
ContentType - Content type for upload.
PostContentSchemaGrantType - Can take a value of accesstokenrefreshtoken, or accesstoken, or refresh_token.
TokenGrantType - Grant type is expected to be refresh_token.