// Code generated by sdkgen. DO NOT EDIT.

//nolint
package postgresql

import (
	"context"

	"google.golang.org/grpc"

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

//revive:disable

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

var _ postgresql.UserServiceClient = &UserServiceClient{}

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

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

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

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

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

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

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