2019-04-11 18:29:34 -04:00
|
|
|
// Code generated by sdkgen. DO NOT EDIT.
|
|
|
|
|
|
|
|
//nolint
|
|
|
|
package containerregistry
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
2019-09-23 14:12:49 -04:00
|
|
|
"github.com/yandex-cloud/go-genproto/yandex/cloud/access"
|
2020-06-09 09:50:34 -04:00
|
|
|
containerregistry "github.com/yandex-cloud/go-genproto/yandex/cloud/containerregistry/v1"
|
2019-04-11 18:29:34 -04:00
|
|
|
"github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
|
|
|
|
)
|
|
|
|
|
|
|
|
//revive:disable
|
|
|
|
|
|
|
|
// RegistryServiceClient is a containerregistry.RegistryServiceClient with
|
|
|
|
// lazy GRPC connection initialization.
|
|
|
|
type RegistryServiceClient struct {
|
|
|
|
getConn func(ctx context.Context) (*grpc.ClientConn, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create implements containerregistry.RegistryServiceClient
|
|
|
|
func (c *RegistryServiceClient) Create(ctx context.Context, in *containerregistry.CreateRegistryRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
|
|
|
|
conn, err := c.getConn(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return containerregistry.NewRegistryServiceClient(conn).Create(ctx, in, opts...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete implements containerregistry.RegistryServiceClient
|
|
|
|
func (c *RegistryServiceClient) Delete(ctx context.Context, in *containerregistry.DeleteRegistryRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
|
|
|
|
conn, err := c.getConn(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return containerregistry.NewRegistryServiceClient(conn).Delete(ctx, in, opts...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get implements containerregistry.RegistryServiceClient
|
|
|
|
func (c *RegistryServiceClient) Get(ctx context.Context, in *containerregistry.GetRegistryRequest, opts ...grpc.CallOption) (*containerregistry.Registry, error) {
|
|
|
|
conn, err := c.getConn(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return containerregistry.NewRegistryServiceClient(conn).Get(ctx, in, opts...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// List implements containerregistry.RegistryServiceClient
|
|
|
|
func (c *RegistryServiceClient) List(ctx context.Context, in *containerregistry.ListRegistriesRequest, opts ...grpc.CallOption) (*containerregistry.ListRegistriesResponse, error) {
|
|
|
|
conn, err := c.getConn(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return containerregistry.NewRegistryServiceClient(conn).List(ctx, in, opts...)
|
|
|
|
}
|
|
|
|
|
2020-06-09 09:50:34 -04:00
|
|
|
type RegistryIterator struct {
|
|
|
|
ctx context.Context
|
|
|
|
opts []grpc.CallOption
|
|
|
|
|
|
|
|
err error
|
|
|
|
started bool
|
|
|
|
|
|
|
|
client *RegistryServiceClient
|
|
|
|
request *containerregistry.ListRegistriesRequest
|
|
|
|
|
|
|
|
items []*containerregistry.Registry
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *RegistryServiceClient) RegistryIterator(ctx context.Context, folderId string, opts ...grpc.CallOption) *RegistryIterator {
|
|
|
|
return &RegistryIterator{
|
|
|
|
ctx: ctx,
|
|
|
|
opts: opts,
|
|
|
|
client: c,
|
|
|
|
request: &containerregistry.ListRegistriesRequest{
|
|
|
|
FolderId: folderId,
|
|
|
|
PageSize: 1000,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (it *RegistryIterator) Next() bool {
|
|
|
|
if it.err != nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if len(it.items) > 1 {
|
|
|
|
it.items[0] = nil
|
|
|
|
it.items = it.items[1:]
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
it.items = nil // consume last item, if any
|
|
|
|
|
|
|
|
if it.started && it.request.PageToken == "" {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
it.started = true
|
|
|
|
|
|
|
|
response, err := it.client.List(it.ctx, it.request, it.opts...)
|
|
|
|
it.err = err
|
|
|
|
if err != nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
it.items = response.Registries
|
|
|
|
it.request.PageToken = response.NextPageToken
|
|
|
|
return len(it.items) > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (it *RegistryIterator) Value() *containerregistry.Registry {
|
|
|
|
if len(it.items) == 0 {
|
|
|
|
panic("calling Value on empty iterator")
|
|
|
|
}
|
|
|
|
return it.items[0]
|
|
|
|
}
|
|
|
|
|
|
|
|
func (it *RegistryIterator) Error() error {
|
|
|
|
return it.err
|
|
|
|
}
|
|
|
|
|
2019-09-23 14:12:49 -04:00
|
|
|
// ListAccessBindings implements containerregistry.RegistryServiceClient
|
|
|
|
func (c *RegistryServiceClient) ListAccessBindings(ctx context.Context, in *access.ListAccessBindingsRequest, opts ...grpc.CallOption) (*access.ListAccessBindingsResponse, error) {
|
|
|
|
conn, err := c.getConn(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return containerregistry.NewRegistryServiceClient(conn).ListAccessBindings(ctx, in, opts...)
|
|
|
|
}
|
|
|
|
|
2020-06-09 09:50:34 -04:00
|
|
|
type RegistryAccessBindingsIterator struct {
|
|
|
|
ctx context.Context
|
|
|
|
opts []grpc.CallOption
|
|
|
|
|
|
|
|
err error
|
|
|
|
started bool
|
|
|
|
|
|
|
|
client *RegistryServiceClient
|
|
|
|
request *access.ListAccessBindingsRequest
|
|
|
|
|
|
|
|
items []*access.AccessBinding
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *RegistryServiceClient) RegistryAccessBindingsIterator(ctx context.Context, resourceId string, opts ...grpc.CallOption) *RegistryAccessBindingsIterator {
|
|
|
|
return &RegistryAccessBindingsIterator{
|
|
|
|
ctx: ctx,
|
|
|
|
opts: opts,
|
|
|
|
client: c,
|
|
|
|
request: &access.ListAccessBindingsRequest{
|
|
|
|
ResourceId: resourceId,
|
|
|
|
PageSize: 1000,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (it *RegistryAccessBindingsIterator) Next() bool {
|
|
|
|
if it.err != nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if len(it.items) > 1 {
|
|
|
|
it.items[0] = nil
|
|
|
|
it.items = it.items[1:]
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
it.items = nil // consume last item, if any
|
|
|
|
|
|
|
|
if it.started && it.request.PageToken == "" {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
it.started = true
|
|
|
|
|
|
|
|
response, err := it.client.ListAccessBindings(it.ctx, it.request, it.opts...)
|
|
|
|
it.err = err
|
|
|
|
if err != nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
it.items = response.AccessBindings
|
|
|
|
it.request.PageToken = response.NextPageToken
|
|
|
|
return len(it.items) > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (it *RegistryAccessBindingsIterator) Value() *access.AccessBinding {
|
|
|
|
if len(it.items) == 0 {
|
|
|
|
panic("calling Value on empty iterator")
|
|
|
|
}
|
|
|
|
return it.items[0]
|
|
|
|
}
|
|
|
|
|
|
|
|
func (it *RegistryAccessBindingsIterator) Error() error {
|
|
|
|
return it.err
|
|
|
|
}
|
|
|
|
|
2019-09-23 14:12:49 -04:00
|
|
|
// SetAccessBindings implements containerregistry.RegistryServiceClient
|
|
|
|
func (c *RegistryServiceClient) SetAccessBindings(ctx context.Context, in *access.SetAccessBindingsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
|
|
|
|
conn, err := c.getConn(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return containerregistry.NewRegistryServiceClient(conn).SetAccessBindings(ctx, in, opts...)
|
|
|
|
}
|
|
|
|
|
2019-04-11 18:29:34 -04:00
|
|
|
// Update implements containerregistry.RegistryServiceClient
|
|
|
|
func (c *RegistryServiceClient) Update(ctx context.Context, in *containerregistry.UpdateRegistryRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
|
|
|
|
conn, err := c.getConn(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return containerregistry.NewRegistryServiceClient(conn).Update(ctx, in, opts...)
|
|
|
|
}
|
2019-09-23 14:12:49 -04:00
|
|
|
|
|
|
|
// UpdateAccessBindings implements containerregistry.RegistryServiceClient
|
|
|
|
func (c *RegistryServiceClient) UpdateAccessBindings(ctx context.Context, in *access.UpdateAccessBindingsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
|
|
|
|
conn, err := c.getConn(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return containerregistry.NewRegistryServiceClient(conn).UpdateAccessBindings(ctx, in, opts...)
|
|
|
|
}
|