role.go raw

   1  // Code generated by sdkgen-v2. DO NOT EDIT.
   2  package iamsdk
   3  
   4  import (
   5  	"context"
   6  
   7  	iam "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1"
   8  	"github.com/yandex-cloud/go-sdk/v2/pkg/transport"
   9  	"google.golang.org/grpc"
  10  	"google.golang.org/protobuf/reflect/protoreflect"
  11  )
  12  
  13  // RoleClient provides methods for managing Role resources of Yandex.Cloud IAM.
  14  type RoleClient interface {
  15  	Get(context.Context, *iam.GetRoleRequest, ...grpc.CallOption) (*iam.Role, error)
  16  	List(context.Context, *iam.ListRolesRequest, ...grpc.CallOption) (*iam.ListRolesResponse, error)
  17  }
  18  
  19  var _ RoleClient = roleClient{}
  20  
  21  type roleClient struct {
  22  	connector transport.Connector
  23  }
  24  
  25  // NewRoleClient returns RoleClient implementation.
  26  func NewRoleClient(connector transport.Connector) RoleClient {
  27  	return roleClient{connector}
  28  }
  29  
  30  // Get is an operation of Yandex.Cloud IAM Role service.
  31  func (c roleClient) Get(ctx context.Context, in *iam.GetRoleRequest, opts ...grpc.CallOption) (*iam.Role, error) {
  32  	connection, err := c.connector.GetConnection(ctx, RoleGet, opts...)
  33  	if err != nil {
  34  		return nil, err
  35  	}
  36  	return iam.NewRoleServiceClient(connection).Get(ctx, in, opts...)
  37  }
  38  
  39  // List is an operation of Yandex.Cloud IAM Role service.
  40  func (c roleClient) List(ctx context.Context, in *iam.ListRolesRequest, opts ...grpc.CallOption) (*iam.ListRolesResponse, error) {
  41  	connection, err := c.connector.GetConnection(ctx, RoleList, opts...)
  42  	if err != nil {
  43  		return nil, err
  44  	}
  45  	return iam.NewRoleServiceClient(connection).List(ctx, in, opts...)
  46  }
  47  
  48  var (
  49  	RoleGet  = protoreflect.FullName("yandex.cloud.iam.v1.RoleService.Get")
  50  	RoleList = protoreflect.FullName("yandex.cloud.iam.v1.RoleService.List")
  51  )
  52