// Code generated by sdkgen. DO NOT EDIT.

// nolint
package cdn

import (
	"context"

	"google.golang.org/grpc"

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

//revive:disable

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

// Prefetch implements cdn.CacheServiceClient
func (c *CacheServiceClient) Prefetch(ctx context.Context, in *cdn.PrefetchCacheRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return cdn.NewCacheServiceClient(conn).Prefetch(ctx, in, opts...)
}

// Purge implements cdn.CacheServiceClient
func (c *CacheServiceClient) Purge(ctx context.Context, in *cdn.PurgeCacheRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return cdn.NewCacheServiceClient(conn).Purge(ctx, in, opts...)
}
