// Code generated by sdkgen. DO NOT EDIT.

//nolint
package mongodb

import (
	"context"

	"google.golang.org/grpc"

	"github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mongodb/v1"
	"github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
)

//revive:disable

// UserServiceClient is a mongodb.UserServiceClient with
// lazy GRPC connection initialization.
type UserServiceClient struct {
	getConn func(ctx context.Context) (*grpc.ClientConn, error)
}

var _ mongodb.UserServiceClient = &UserServiceClient{}

// Create implements mongodb.UserServiceClient
func (c *UserServiceClient) Create(ctx context.Context, in *mongodb.CreateUserRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewUserServiceClient(conn).Create(ctx, in, opts...)
}

// Delete implements mongodb.UserServiceClient
func (c *UserServiceClient) Delete(ctx context.Context, in *mongodb.DeleteUserRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewUserServiceClient(conn).Delete(ctx, in, opts...)
}

// Get implements mongodb.UserServiceClient
func (c *UserServiceClient) Get(ctx context.Context, in *mongodb.GetUserRequest, opts ...grpc.CallOption) (*mongodb.User, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewUserServiceClient(conn).Get(ctx, in, opts...)
}

// GrantPermission implements mongodb.UserServiceClient
func (c *UserServiceClient) GrantPermission(ctx context.Context, in *mongodb.GrantUserPermissionRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewUserServiceClient(conn).GrantPermission(ctx, in, opts...)
}

// List implements mongodb.UserServiceClient
func (c *UserServiceClient) List(ctx context.Context, in *mongodb.ListUsersRequest, opts ...grpc.CallOption) (*mongodb.ListUsersResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewUserServiceClient(conn).List(ctx, in, opts...)
}

// RevokePermission implements mongodb.UserServiceClient
func (c *UserServiceClient) RevokePermission(ctx context.Context, in *mongodb.RevokeUserPermissionRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewUserServiceClient(conn).RevokePermission(ctx, in, opts...)
}

// Update implements mongodb.UserServiceClient
func (c *UserServiceClient) Update(ctx context.Context, in *mongodb.UpdateUserRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewUserServiceClient(conn).Update(ctx, in, opts...)
}
