// Code generated by sdkgen. DO NOT EDIT.

//nolint
package loadbalancer

import (
	"context"

	"google.golang.org/grpc"

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

//revive:disable

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

var _ loadbalancer.TargetGroupServiceClient = &TargetGroupServiceClient{}

// AddTargets implements loadbalancer.TargetGroupServiceClient
func (c *TargetGroupServiceClient) AddTargets(ctx context.Context, in *loadbalancer.AddTargetsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return loadbalancer.NewTargetGroupServiceClient(conn).AddTargets(ctx, in, opts...)
}

// Create implements loadbalancer.TargetGroupServiceClient
func (c *TargetGroupServiceClient) Create(ctx context.Context, in *loadbalancer.CreateTargetGroupRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return loadbalancer.NewTargetGroupServiceClient(conn).Create(ctx, in, opts...)
}

// Delete implements loadbalancer.TargetGroupServiceClient
func (c *TargetGroupServiceClient) Delete(ctx context.Context, in *loadbalancer.DeleteTargetGroupRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return loadbalancer.NewTargetGroupServiceClient(conn).Delete(ctx, in, opts...)
}

// Get implements loadbalancer.TargetGroupServiceClient
func (c *TargetGroupServiceClient) Get(ctx context.Context, in *loadbalancer.GetTargetGroupRequest, opts ...grpc.CallOption) (*loadbalancer.TargetGroup, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return loadbalancer.NewTargetGroupServiceClient(conn).Get(ctx, in, opts...)
}

// List implements loadbalancer.TargetGroupServiceClient
func (c *TargetGroupServiceClient) List(ctx context.Context, in *loadbalancer.ListTargetGroupsRequest, opts ...grpc.CallOption) (*loadbalancer.ListTargetGroupsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return loadbalancer.NewTargetGroupServiceClient(conn).List(ctx, in, opts...)
}

// ListOperations implements loadbalancer.TargetGroupServiceClient
func (c *TargetGroupServiceClient) ListOperations(ctx context.Context, in *loadbalancer.ListTargetGroupOperationsRequest, opts ...grpc.CallOption) (*loadbalancer.ListTargetGroupOperationsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return loadbalancer.NewTargetGroupServiceClient(conn).ListOperations(ctx, in, opts...)
}

// RemoveTargets implements loadbalancer.TargetGroupServiceClient
func (c *TargetGroupServiceClient) RemoveTargets(ctx context.Context, in *loadbalancer.RemoveTargetsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return loadbalancer.NewTargetGroupServiceClient(conn).RemoveTargets(ctx, in, opts...)
}

// Update implements loadbalancer.TargetGroupServiceClient
func (c *TargetGroupServiceClient) Update(ctx context.Context, in *loadbalancer.UpdateTargetGroupRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return loadbalancer.NewTargetGroupServiceClient(conn).Update(ctx, in, opts...)
}
