https://github.com/selectel/craas-go
Go SDK for Container Registry Service
https://github.com/selectel/craas-go
Last synced: 5 months ago
JSON representation
Go SDK for Container Registry Service
- Host: GitHub
- URL: https://github.com/selectel/craas-go
- Owner: selectel
- License: apache-2.0
- Created: 2022-10-14T11:10:13.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-22T13:53:03.000Z (12 months ago)
- Last Synced: 2025-08-25T18:48:50.901Z (11 months ago)
- Language: Go
- Size: 79.1 KB
- Stars: 2
- Watchers: 6
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# craas-go: Go SDK for Container Registry Service
[](https://pkg.go.dev/github.com/selectel/craas-go/)
[](https://goreportcard.com/report/github.com/selectel/craas-go)
[](https://coveralls.io/github/selectel/craas-go?branch=master)
Package craas-go provides Go SDK to work with the Selectel Container Registry Service.
## Documentation
The Go library documentation is available at [go.dev](https://pkg.go.dev/github.com/selectel/craas-go/).
## What this library is capable of
You can use this library to work with the following objects of the Selectel Container Registry Service:
* [token](https://pkg.go.dev/github.com/selectel/craas-go/pkg/v1/token)
* [registry](https://pkg.go.dev/github.com/selectel/craas-go/pkg/v1/registry)
* [repository](https://pkg.go.dev/github.com/selectel/craas-go/pkg/v1/repository)
* [garbage-collection](https://pkg.go.dev/github.com/selectel/craas-go/pkg/v1/gc)
## Getting started
### Installation
You can install needed `craas-go` packages via `go get` command:
```bash
go get github.com/selectel/craas-go/pkg/v1/registry
```
### Authentication
To work with the Selectel Container Registry API you first need to:
* Create a Selectel account: [registration page](https://my.selectel.ru/registration).
* Create a project in Selectel Cloud Platform [projects](https://my.selectel.ru/vpc/projects).
* Retrieve a token for your project via API or [go-selvpcclient](https://github.com/selectel/go-selvpcclient).
### Endpoints
Selectel Container Registry Service currently has the following API endpoints:
| URL |
|-------------------------------|
| https://cr.selcloud.ru/api/v1 |
### Usage example
```go
package main
import (
"context"
"fmt"
"log"
v1 "github.com/selectel/craas-go/pkg"
"github.com/selectel/craas-go/pkg/v1/registry"
"github.com/selectel/craas-go/pkg/v1/repository"
)
func main() {
// Token to work with Selectel Cloud project.
token := "gAAAAABeVNzu-..."
// CRaaS endpoint to work with.
endpoint := "https://cr.selcloud.ru/api/v1"
// Create a new CRaaS client.
crClient := v1.NewCRaaSClientV1(token, endpoint)
// Prepare empty context.
ctx := context.Background()
// Create a new registry.
createdRegistry, _, err := registry.Create(ctx, crClient, "my-registry")
if err != nil {
log.Fatal(err)
}
// Print the registry fields.
fmt.Printf("Created registry: %+v", createdRegistry)
// Get a list of registry repositories.
repositories, _, err := repository.ListRepositories(ctx, crClient, createdRegistry.ID)
if err != nil {
log.Fatal(err)
}
// Print the repository fields.
for _, repo := range repositories {
fmt.Printf("Repository: %+v", repo)
}
}
```