// Code generated by sdkgen-v2. DO NOT EDIT.
package kmssdk

import (
	"context"

	access "github.com/yandex-cloud/go-genproto/yandex/cloud/access"
	kms "github.com/yandex-cloud/go-genproto/yandex/cloud/kms/v1"
	operation "github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
	sdkop "github.com/yandex-cloud/go-sdk/v2/pkg/operation"
	"github.com/yandex-cloud/go-sdk/v2/pkg/transport"
	"google.golang.org/grpc"
	"google.golang.org/protobuf/reflect/protoreflect"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

// SymmetricKeyClient provides methods for managing SymmetricKey resources of Yandex.Cloud KMS.
type SymmetricKeyClient interface {
	SymmetricKeyClientIterator
	Create(context.Context, *kms.CreateSymmetricKeyRequest, ...grpc.CallOption) (*SymmetricKeyCreateOperation, error)
	Get(context.Context, *kms.GetSymmetricKeyRequest, ...grpc.CallOption) (*kms.SymmetricKey, error)
	List(context.Context, *kms.ListSymmetricKeysRequest, ...grpc.CallOption) (*kms.ListSymmetricKeysResponse, error)
	ListVersions(context.Context, *kms.ListSymmetricKeyVersionsRequest, ...grpc.CallOption) (*kms.ListSymmetricKeyVersionsResponse, error)
	Update(context.Context, *kms.UpdateSymmetricKeyRequest, ...grpc.CallOption) (*SymmetricKeyUpdateOperation, error)
	Delete(context.Context, *kms.DeleteSymmetricKeyRequest, ...grpc.CallOption) (*SymmetricKeyDeleteOperation, error)
	SetPrimaryVersion(context.Context, *kms.SetPrimarySymmetricKeyVersionRequest, ...grpc.CallOption) (*SymmetricKeySetPrimaryVersionOperation, error)
	ScheduleVersionDestruction(context.Context, *kms.ScheduleSymmetricKeyVersionDestructionRequest, ...grpc.CallOption) (*SymmetricKeyScheduleVersionDestructionOperation, error)
	CancelVersionDestruction(context.Context, *kms.CancelSymmetricKeyVersionDestructionRequest, ...grpc.CallOption) (*SymmetricKeyCancelVersionDestructionOperation, error)
	Rotate(context.Context, *kms.RotateSymmetricKeyRequest, ...grpc.CallOption) (*SymmetricKeyRotateOperation, error)
	ListOperations(context.Context, *kms.ListSymmetricKeyOperationsRequest, ...grpc.CallOption) (*kms.ListSymmetricKeyOperationsResponse, error)
	ListAccessBindings(context.Context, *access.ListAccessBindingsRequest, ...grpc.CallOption) (*access.ListAccessBindingsResponse, error)
	SetAccessBindings(context.Context, *access.SetAccessBindingsRequest, ...grpc.CallOption) (*SymmetricKeySetAccessBindingsOperation, error)
	UpdateAccessBindings(context.Context, *access.UpdateAccessBindingsRequest, ...grpc.CallOption) (*SymmetricKeyUpdateAccessBindingsOperation, error)
}

var _ SymmetricKeyClient = symmetricKeyClient{}

type symmetricKeyClient struct {
	connector transport.Connector
}

// NewSymmetricKeyClient returns SymmetricKeyClient implementation.
func NewSymmetricKeyClient(connector transport.Connector) SymmetricKeyClient {
	return symmetricKeyClient{connector}
}

// SymmetricKeyCreateOperation is used to monitor the state of Create operations.
type SymmetricKeyCreateOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeyCreateOperation) Metadata() *kms.CreateSymmetricKeyMetadata {
	return o.Operation.Metadata().(*kms.CreateSymmetricKeyMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeyCreateOperation) Response() *kms.SymmetricKey {
	return o.Operation.Response().(*kms.SymmetricKey)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeyCreateOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeyCreateOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// Create is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) Create(ctx context.Context, in *kms.CreateSymmetricKeyRequest, opts ...grpc.CallOption) (*SymmetricKeyCreateOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyCreate, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).Create(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*kms.CreateSymmetricKeyMetadata)(nil),
		ResponseType: (*kms.SymmetricKey)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeyCreateOperation{*op}, nil
}

// Get is an operation of Yandex.Cloud KMS SymmetricKey service.
func (c symmetricKeyClient) Get(ctx context.Context, in *kms.GetSymmetricKeyRequest, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyGet, opts...)
	if err != nil {
		return nil, err
	}
	return kms.NewSymmetricKeyServiceClient(connection).Get(ctx, in, opts...)
}

// List is an operation of Yandex.Cloud KMS SymmetricKey service.
func (c symmetricKeyClient) List(ctx context.Context, in *kms.ListSymmetricKeysRequest, opts ...grpc.CallOption) (*kms.ListSymmetricKeysResponse, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyList, opts...)
	if err != nil {
		return nil, err
	}
	return kms.NewSymmetricKeyServiceClient(connection).List(ctx, in, opts...)
}

// ListVersions is an operation of Yandex.Cloud KMS SymmetricKey service.
func (c symmetricKeyClient) ListVersions(ctx context.Context, in *kms.ListSymmetricKeyVersionsRequest, opts ...grpc.CallOption) (*kms.ListSymmetricKeyVersionsResponse, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyListVersions, opts...)
	if err != nil {
		return nil, err
	}
	return kms.NewSymmetricKeyServiceClient(connection).ListVersions(ctx, in, opts...)
}

// SymmetricKeyUpdateOperation is used to monitor the state of Update operations.
type SymmetricKeyUpdateOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeyUpdateOperation) Metadata() *kms.UpdateSymmetricKeyMetadata {
	return o.Operation.Metadata().(*kms.UpdateSymmetricKeyMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeyUpdateOperation) Response() *kms.SymmetricKey {
	return o.Operation.Response().(*kms.SymmetricKey)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeyUpdateOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeyUpdateOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// Update is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) Update(ctx context.Context, in *kms.UpdateSymmetricKeyRequest, opts ...grpc.CallOption) (*SymmetricKeyUpdateOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyUpdate, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).Update(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*kms.UpdateSymmetricKeyMetadata)(nil),
		ResponseType: (*kms.SymmetricKey)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeyUpdateOperation{*op}, nil
}

// SymmetricKeyDeleteOperation is used to monitor the state of Delete operations.
type SymmetricKeyDeleteOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeyDeleteOperation) Metadata() *kms.DeleteSymmetricKeyMetadata {
	return o.Operation.Metadata().(*kms.DeleteSymmetricKeyMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeyDeleteOperation) Response() *kms.SymmetricKey {
	return o.Operation.Response().(*kms.SymmetricKey)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeyDeleteOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeyDeleteOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// Delete is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) Delete(ctx context.Context, in *kms.DeleteSymmetricKeyRequest, opts ...grpc.CallOption) (*SymmetricKeyDeleteOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyDelete, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).Delete(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*kms.DeleteSymmetricKeyMetadata)(nil),
		ResponseType: (*kms.SymmetricKey)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeyDeleteOperation{*op}, nil
}

// SymmetricKeySetPrimaryVersionOperation is used to monitor the state of SetPrimaryVersion operations.
type SymmetricKeySetPrimaryVersionOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeySetPrimaryVersionOperation) Metadata() *kms.SetPrimarySymmetricKeyVersionMetadata {
	return o.Operation.Metadata().(*kms.SetPrimarySymmetricKeyVersionMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeySetPrimaryVersionOperation) Response() *kms.SymmetricKey {
	return o.Operation.Response().(*kms.SymmetricKey)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeySetPrimaryVersionOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeySetPrimaryVersionOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// SetPrimaryVersion is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) SetPrimaryVersion(ctx context.Context, in *kms.SetPrimarySymmetricKeyVersionRequest, opts ...grpc.CallOption) (*SymmetricKeySetPrimaryVersionOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeySetPrimaryVersion, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).SetPrimaryVersion(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*kms.SetPrimarySymmetricKeyVersionMetadata)(nil),
		ResponseType: (*kms.SymmetricKey)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeySetPrimaryVersionOperation{*op}, nil
}

// SymmetricKeyScheduleVersionDestructionOperation is used to monitor the state of ScheduleVersionDestruction operations.
type SymmetricKeyScheduleVersionDestructionOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeyScheduleVersionDestructionOperation) Metadata() *kms.ScheduleSymmetricKeyVersionDestructionMetadata {
	return o.Operation.Metadata().(*kms.ScheduleSymmetricKeyVersionDestructionMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeyScheduleVersionDestructionOperation) Response() *kms.SymmetricKeyVersion {
	return o.Operation.Response().(*kms.SymmetricKeyVersion)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeyScheduleVersionDestructionOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*kms.SymmetricKeyVersion, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*kms.SymmetricKeyVersion)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeyScheduleVersionDestructionOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*kms.SymmetricKeyVersion, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*kms.SymmetricKeyVersion)
	return response, err
}

// ScheduleVersionDestruction is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) ScheduleVersionDestruction(ctx context.Context, in *kms.ScheduleSymmetricKeyVersionDestructionRequest, opts ...grpc.CallOption) (*SymmetricKeyScheduleVersionDestructionOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyScheduleVersionDestruction, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).ScheduleVersionDestruction(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*kms.ScheduleSymmetricKeyVersionDestructionMetadata)(nil),
		ResponseType: (*kms.SymmetricKeyVersion)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeyScheduleVersionDestructionOperation{*op}, nil
}

// SymmetricKeyCancelVersionDestructionOperation is used to monitor the state of CancelVersionDestruction operations.
type SymmetricKeyCancelVersionDestructionOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeyCancelVersionDestructionOperation) Metadata() *kms.CancelSymmetricKeyVersionDestructionMetadata {
	return o.Operation.Metadata().(*kms.CancelSymmetricKeyVersionDestructionMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeyCancelVersionDestructionOperation) Response() *kms.SymmetricKeyVersion {
	return o.Operation.Response().(*kms.SymmetricKeyVersion)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeyCancelVersionDestructionOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*kms.SymmetricKeyVersion, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*kms.SymmetricKeyVersion)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeyCancelVersionDestructionOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*kms.SymmetricKeyVersion, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*kms.SymmetricKeyVersion)
	return response, err
}

// CancelVersionDestruction is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) CancelVersionDestruction(ctx context.Context, in *kms.CancelSymmetricKeyVersionDestructionRequest, opts ...grpc.CallOption) (*SymmetricKeyCancelVersionDestructionOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyCancelVersionDestruction, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).CancelVersionDestruction(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*kms.CancelSymmetricKeyVersionDestructionMetadata)(nil),
		ResponseType: (*kms.SymmetricKeyVersion)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeyCancelVersionDestructionOperation{*op}, nil
}

// SymmetricKeyRotateOperation is used to monitor the state of Rotate operations.
type SymmetricKeyRotateOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeyRotateOperation) Metadata() *kms.RotateSymmetricKeyMetadata {
	return o.Operation.Metadata().(*kms.RotateSymmetricKeyMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeyRotateOperation) Response() *kms.SymmetricKey {
	return o.Operation.Response().(*kms.SymmetricKey)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeyRotateOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeyRotateOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*kms.SymmetricKey, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*kms.SymmetricKey)
	return response, err
}

// Rotate is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) Rotate(ctx context.Context, in *kms.RotateSymmetricKeyRequest, opts ...grpc.CallOption) (*SymmetricKeyRotateOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyRotate, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).Rotate(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*kms.RotateSymmetricKeyMetadata)(nil),
		ResponseType: (*kms.SymmetricKey)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeyRotateOperation{*op}, nil
}

// ListOperations is an operation of Yandex.Cloud KMS SymmetricKey service.
func (c symmetricKeyClient) ListOperations(ctx context.Context, in *kms.ListSymmetricKeyOperationsRequest, opts ...grpc.CallOption) (*kms.ListSymmetricKeyOperationsResponse, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyListOperations, opts...)
	if err != nil {
		return nil, err
	}
	return kms.NewSymmetricKeyServiceClient(connection).ListOperations(ctx, in, opts...)
}

// ListAccessBindings is an operation of Yandex.Cloud KMS SymmetricKey service.
func (c symmetricKeyClient) ListAccessBindings(ctx context.Context, in *access.ListAccessBindingsRequest, opts ...grpc.CallOption) (*access.ListAccessBindingsResponse, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyListAccessBindings, opts...)
	if err != nil {
		return nil, err
	}
	return kms.NewSymmetricKeyServiceClient(connection).ListAccessBindings(ctx, in, opts...)
}

// SymmetricKeySetAccessBindingsOperation is used to monitor the state of SetAccessBindings operations.
type SymmetricKeySetAccessBindingsOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeySetAccessBindingsOperation) Metadata() *access.SetAccessBindingsMetadata {
	return o.Operation.Metadata().(*access.SetAccessBindingsMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeySetAccessBindingsOperation) Response() *emptypb.Empty {
	return o.Operation.Response().(*emptypb.Empty)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeySetAccessBindingsOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*emptypb.Empty)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeySetAccessBindingsOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*emptypb.Empty)
	return response, err
}

// SetAccessBindings is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) SetAccessBindings(ctx context.Context, in *access.SetAccessBindingsRequest, opts ...grpc.CallOption) (*SymmetricKeySetAccessBindingsOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeySetAccessBindings, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).SetAccessBindings(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*access.SetAccessBindingsMetadata)(nil),
		ResponseType: (*emptypb.Empty)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeySetAccessBindingsOperation{*op}, nil
}

// SymmetricKeyUpdateAccessBindingsOperation is used to monitor the state of UpdateAccessBindings operations.
type SymmetricKeyUpdateAccessBindingsOperation struct {
	sdkop.Operation
}

// Metadata retrieves the operation metadata.
func (o *SymmetricKeyUpdateAccessBindingsOperation) Metadata() *access.UpdateAccessBindingsMetadata {
	return o.Operation.Metadata().(*access.UpdateAccessBindingsMetadata)
}

// Response retrieves the operation response.
func (o *SymmetricKeyUpdateAccessBindingsOperation) Response() *emptypb.Empty {
	return o.Operation.Response().(*emptypb.Empty)
}

// Wait polls the operation until it's done.
func (o *SymmetricKeyUpdateAccessBindingsOperation) Wait(ctx context.Context, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	abstract, err := o.Operation.Wait(ctx, opts...)
	response, _ := abstract.(*emptypb.Empty)
	return response, err
}

// WaitInterval polls the operation until it's done with custom interval.
func (o *SymmetricKeyUpdateAccessBindingsOperation) WaitInterval(ctx context.Context, pollInterval sdkop.PollIntervalFunc, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	abstract, err := o.Operation.WaitInterval(ctx, pollInterval, opts...)
	response, _ := abstract.(*emptypb.Empty)
	return response, err
}

// UpdateAccessBindings is an operation of Yandex.Cloud KMS SymmetricKey service.
// It returns an object which should be used to monitor the operation state.
func (c symmetricKeyClient) UpdateAccessBindings(ctx context.Context, in *access.UpdateAccessBindingsRequest, opts ...grpc.CallOption) (*SymmetricKeyUpdateAccessBindingsOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyUpdateAccessBindings, opts...)
	if err != nil {
		return nil, err
	}
	pb, err := kms.NewSymmetricKeyServiceClient(connection).UpdateAccessBindings(ctx, in, opts...)
	if err != nil {
		return nil, err
	}
	op, err := sdkop.NewOperation(pb, &sdkop.Concretization{
		Poll:         c.pollOperation,
		MetadataType: (*access.UpdateAccessBindingsMetadata)(nil),
		ResponseType: (*emptypb.Empty)(nil),
	})
	if err != nil {
		return nil, err
	}
	return &SymmetricKeyUpdateAccessBindingsOperation{*op}, nil
}

// pollOperation returns the current state of the polled operation.
func (c symmetricKeyClient) pollOperation(ctx context.Context, operationId string, opts ...grpc.CallOption) (sdkop.YCOperation, error) {
	connection, err := c.connector.GetConnection(ctx, SymmetricKeyOperationPoller, opts...)
	if err != nil {
		return nil, err
	}
	return operation.NewOperationServiceClient(connection).Get(ctx, &operation.GetOperationRequest{OperationId: operationId}, opts...)
}

var (
	SymmetricKeyCreate                     = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.Create")
	SymmetricKeyGet                        = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.Get")
	SymmetricKeyList                       = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.List")
	SymmetricKeyListVersions               = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.ListVersions")
	SymmetricKeyUpdate                     = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.Update")
	SymmetricKeyDelete                     = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.Delete")
	SymmetricKeySetPrimaryVersion          = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.SetPrimaryVersion")
	SymmetricKeyScheduleVersionDestruction = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.ScheduleVersionDestruction")
	SymmetricKeyCancelVersionDestruction   = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.CancelVersionDestruction")
	SymmetricKeyRotate                     = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.Rotate")
	SymmetricKeyListOperations             = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.ListOperations")
	SymmetricKeyListAccessBindings         = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.ListAccessBindings")
	SymmetricKeySetAccessBindings          = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.SetAccessBindings")
	SymmetricKeyUpdateAccessBindings       = protoreflect.FullName("yandex.cloud.kms.v1.SymmetricKeyService.UpdateAccessBindings")
	SymmetricKeyOperationPoller            = protoreflect.FullName("yandex.cloud.operation.OperationService.Get")
)
