// Code generated by sdkgen. DO NOT EDIT.

//nolint
package clickhouse

import (
	"context"

	"google.golang.org/grpc"

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

//revive:disable

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

var _ clickhouse.DatabaseServiceClient = &DatabaseServiceClient{}

// Create implements clickhouse.DatabaseServiceClient
func (c *DatabaseServiceClient) Create(ctx context.Context, in *clickhouse.CreateDatabaseRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return clickhouse.NewDatabaseServiceClient(conn).Create(ctx, in, opts...)
}

// Delete implements clickhouse.DatabaseServiceClient
func (c *DatabaseServiceClient) Delete(ctx context.Context, in *clickhouse.DeleteDatabaseRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return clickhouse.NewDatabaseServiceClient(conn).Delete(ctx, in, opts...)
}

// Get implements clickhouse.DatabaseServiceClient
func (c *DatabaseServiceClient) Get(ctx context.Context, in *clickhouse.GetDatabaseRequest, opts ...grpc.CallOption) (*clickhouse.Database, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return clickhouse.NewDatabaseServiceClient(conn).Get(ctx, in, opts...)
}

// List implements clickhouse.DatabaseServiceClient
func (c *DatabaseServiceClient) List(ctx context.Context, in *clickhouse.ListDatabasesRequest, opts ...grpc.CallOption) (*clickhouse.ListDatabasesResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return clickhouse.NewDatabaseServiceClient(conn).List(ctx, in, opts...)
}
