// Code generated by sdkgen. DO NOT EDIT.

//nolint
package functions

import (
	"context"

	"google.golang.org/grpc"

	"github.com/yandex-cloud/go-genproto/yandex/cloud/access"
	"github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
	"github.com/yandex-cloud/go-genproto/yandex/cloud/serverless/functions/v1"
)

//revive:disable

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

var _ functions.FunctionServiceClient = &FunctionServiceClient{}

// Create implements functions.FunctionServiceClient
func (c *FunctionServiceClient) Create(ctx context.Context, in *functions.CreateFunctionRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).Create(ctx, in, opts...)
}

// CreateFunctionVersion implements functions.FunctionServiceClient
func (c *FunctionServiceClient) CreateFunctionVersion(ctx context.Context, in *functions.CreateFunctionVersionRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).CreateFunctionVersion(ctx, in, opts...)
}

// Delete implements functions.FunctionServiceClient
func (c *FunctionServiceClient) Delete(ctx context.Context, in *functions.DeleteFunctionRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).Delete(ctx, in, opts...)
}

// Get implements functions.FunctionServiceClient
func (c *FunctionServiceClient) Get(ctx context.Context, in *functions.GetFunctionRequest, opts ...grpc.CallOption) (*functions.Function, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).Get(ctx, in, opts...)
}

// GetFunctionVersion implements functions.FunctionServiceClient
func (c *FunctionServiceClient) GetFunctionVersion(ctx context.Context, in *functions.GetFunctionVersionRequest, opts ...grpc.CallOption) (*functions.Version, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).GetFunctionVersion(ctx, in, opts...)
}

// GetFunctionVersionByTag implements functions.FunctionServiceClient
func (c *FunctionServiceClient) GetFunctionVersionByTag(ctx context.Context, in *functions.GetFunctionVersionByTagRequest, opts ...grpc.CallOption) (*functions.Version, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).GetFunctionVersionByTag(ctx, in, opts...)
}

// List implements functions.FunctionServiceClient
func (c *FunctionServiceClient) List(ctx context.Context, in *functions.ListFunctionsRequest, opts ...grpc.CallOption) (*functions.ListFunctionsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).List(ctx, in, opts...)
}

// ListAccessBindings implements functions.FunctionServiceClient
func (c *FunctionServiceClient) ListAccessBindings(ctx context.Context, in *access.ListAccessBindingsRequest, opts ...grpc.CallOption) (*access.ListAccessBindingsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).ListAccessBindings(ctx, in, opts...)
}

// ListFunctionTagHistory implements functions.FunctionServiceClient
func (c *FunctionServiceClient) ListFunctionTagHistory(ctx context.Context, in *functions.ListFunctionTagHistoryRequest, opts ...grpc.CallOption) (*functions.ListFunctionTagHistoryResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).ListFunctionTagHistory(ctx, in, opts...)
}

// ListFunctionVersions implements functions.FunctionServiceClient
func (c *FunctionServiceClient) ListFunctionVersions(ctx context.Context, in *functions.ListFunctionsVersionsRequest, opts ...grpc.CallOption) (*functions.ListFunctionsVersionsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).ListFunctionVersions(ctx, in, opts...)
}

// ListOperations implements functions.FunctionServiceClient
func (c *FunctionServiceClient) ListOperations(ctx context.Context, in *functions.ListFunctionOperationsRequest, opts ...grpc.CallOption) (*functions.ListFunctionOperationsResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).ListOperations(ctx, in, opts...)
}

// ListRuntimes implements functions.FunctionServiceClient
func (c *FunctionServiceClient) ListRuntimes(ctx context.Context, in *functions.ListRuntimesRequest, opts ...grpc.CallOption) (*functions.ListRuntimesResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).ListRuntimes(ctx, in, opts...)
}

// RemoveTag implements functions.FunctionServiceClient
func (c *FunctionServiceClient) RemoveTag(ctx context.Context, in *functions.RemoveFunctionTagRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).RemoveTag(ctx, in, opts...)
}

// SetAccessBindings implements functions.FunctionServiceClient
func (c *FunctionServiceClient) SetAccessBindings(ctx context.Context, in *access.SetAccessBindingsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).SetAccessBindings(ctx, in, opts...)
}

// SetTag implements functions.FunctionServiceClient
func (c *FunctionServiceClient) SetTag(ctx context.Context, in *functions.SetFunctionTagRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).SetTag(ctx, in, opts...)
}

// Update implements functions.FunctionServiceClient
func (c *FunctionServiceClient) Update(ctx context.Context, in *functions.UpdateFunctionRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).Update(ctx, in, opts...)
}

// UpdateAccessBindings implements functions.FunctionServiceClient
func (c *FunctionServiceClient) UpdateAccessBindings(ctx context.Context, in *access.UpdateAccessBindingsRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return functions.NewFunctionServiceClient(conn).UpdateAccessBindings(ctx, in, opts...)
}
