artifactregistryservice

package
v1.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactInfo

type ArtifactInfo struct {
	Name       string `json:"name"`
	Format     string `json:"format"`
	Version    string `json:"version"`
	Location   string `json:"location"`
	Repository string `json:"repository"`
	SizeBytes  string `json:"virtualSize"`
	Updated    string `json:"updated"`
	Digest     string `json:"digest"`
	ProjectID  string `json:"projectID"`
}

ArtifactInfo represents the basic information of an artifact within a registry.

type ArtifactRegistryClientWrapper

type ArtifactRegistryClientWrapper struct {
	Closer            func() error
	RepositoryLister  func(ctx context.Context, req *artifactregistrypb.ListRepositoriesRequest, opts ...gax.CallOption) models.GenericIterator[artifactregistrypb.Repository]
	LocationLister    func(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) models.GenericIterator[locationpb.Location]
	RepositoryGetter  func(ctx context.Context, req *artifactregistrypb.GetRepositoryRequest, opts ...gax.CallOption) (*artifactregistrypb.Repository, error)
	DockerImageLister func(ctx context.Context, req *artifactregistrypb.ListDockerImagesRequest, opts ...gax.CallOption) models.GenericIterator[artifactregistrypb.DockerImage]
}

Function calls to the API are wrapped to facilitate mocking

func (*ArtifactRegistryClientWrapper) GetRepository

func (*ArtifactRegistryClientWrapper) ListDockerImages

func (*ArtifactRegistryClientWrapper) ListLocations

func (*ArtifactRegistryClientWrapper) ListRepositories

type ArtifactRegistryService

type ArtifactRegistryService struct {
	Client *ArtifactRegistryClientWrapper
}

ArtifactRegistryService provides methods to interact with Artifact Registry resources.

func New

New creates a new instance of the ArtifactRegistryService using an artifactregistry.Client

func (*ArtifactRegistryService) Artifacts

func (ars *ArtifactRegistryService) Artifacts(projectID string, location string, repositoryName string) ([]ArtifactInfo, error)

Artifacts fetches the artifacts for a given repository, handling different formats.

func (*ArtifactRegistryService) DockerImages

func (ars *ArtifactRegistryService) DockerImages(repositoryName string) ([]ArtifactInfo, error)

listDockerImages specifically lists Docker images within a given repository.

func (*ArtifactRegistryService) Repositories

func (ars *ArtifactRegistryService) Repositories(projectID string) ([]RepositoryInfo, error)

RepositoriesAndArtifacts returns a list of repositories and artifacts given projectID. TODO consider putting location as input, so that we can put Locations iteration before it & potentially filter by location at top level of GCP module

func (*ArtifactRegistryService) RepositoriesAndArtifacts

func (ars *ArtifactRegistryService) RepositoriesAndArtifacts(projectID string) (CombinedRepoArtifactInfo, error)

RepositoriesAndArtifacts retrieves both repositories and their artifacts for a given projectID.

type CombinedRepoArtifactInfo

type CombinedRepoArtifactInfo struct {
	Repositories []RepositoryInfo `json:"repositories"`
	Artifacts    []ArtifactInfo   `json:"artifacts"`
}

CombinedRepoArtifactInfo holds the combined information of repositories and their respective artifacts.

type DockerImageDetails

type DockerImageDetails struct {
	ProjectID  string `json:"projectID"`
	Location   string `json:"location"`
	Repository string `json:"repository"`
	ImageName  string `json:"name"`
	Digest     string `json:"digest"`
}

DockerImageDetails holds the extracted parts from a Docker image name.

type RepositoryInfo

type RepositoryInfo struct {
	Name        string `json:"name"`
	Format      string `json:"format"`
	Description string `json:"description"`
	SizeBytes   string `json:"sizeBytes"`
	ProjectID   string `json:"projectID"`
	Location    string `json:"location"`
}

RepositoryInfo holds information about a repository and its artifacts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL