// 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

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

var _ postgresql.ClusterServiceClient = &ClusterServiceClient{}

// AddHosts implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) AddHosts(ctx context.Context, in *postgresql.AddClusterHostsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).AddHosts(ctx, in, opts...)
}

// Backup implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) Backup(ctx context.Context, in *postgresql.BackupClusterRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).Backup(ctx, in, opts...)
}

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

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

// DeleteHosts implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) DeleteHosts(ctx context.Context, in *postgresql.DeleteClusterHostsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).DeleteHosts(ctx, in, opts...)
}

// Get implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) Get(ctx context.Context, in *postgresql.GetClusterRequest, opts ...grpc.CallOption) (*postgresql.Cluster, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).Get(ctx, in, opts...)
}

// List implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) List(ctx context.Context, in *postgresql.ListClustersRequest, opts ...grpc.CallOption) (*postgresql.ListClustersResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).List(ctx, in, opts...)
}

// ListBackups implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) ListBackups(ctx context.Context, in *postgresql.ListClusterBackupsRequest, opts ...grpc.CallOption) (*postgresql.ListClusterBackupsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).ListBackups(ctx, in, opts...)
}

// ListHosts implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) ListHosts(ctx context.Context, in *postgresql.ListClusterHostsRequest, opts ...grpc.CallOption) (*postgresql.ListClusterHostsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).ListHosts(ctx, in, opts...)
}

// ListLogs implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) ListLogs(ctx context.Context, in *postgresql.ListClusterLogsRequest, opts ...grpc.CallOption) (*postgresql.ListClusterLogsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).ListLogs(ctx, in, opts...)
}

// ListOperations implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) ListOperations(ctx context.Context, in *postgresql.ListClusterOperationsRequest, opts ...grpc.CallOption) (*postgresql.ListClusterOperationsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).ListOperations(ctx, in, opts...)
}

// Move implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) Move(ctx context.Context, in *postgresql.MoveClusterRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).Move(ctx, in, opts...)
}

// Restore implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) Restore(ctx context.Context, in *postgresql.RestoreClusterRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).Restore(ctx, in, opts...)
}

// Start implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) Start(ctx context.Context, in *postgresql.StartClusterRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).Start(ctx, in, opts...)
}

// StartFailover implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) StartFailover(ctx context.Context, in *postgresql.StartClusterFailoverRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).StartFailover(ctx, in, opts...)
}

// Stop implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) Stop(ctx context.Context, in *postgresql.StopClusterRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).Stop(ctx, in, opts...)
}

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

// UpdateHosts implements postgresql.ClusterServiceClient
func (c *ClusterServiceClient) UpdateHosts(ctx context.Context, in *postgresql.UpdateClusterHostsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return postgresql.NewClusterServiceClient(conn).UpdateHosts(ctx, in, opts...)
}
