// Code generated by sdkgen-v2. DO NOT EDIT.
package iamsdk

import (
	"context"

	iam "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1"
	"github.com/yandex-cloud/go-sdk/v2/pkg/sdkresolvers"
)

type oAuthClientResolver struct {
	client OAuthClientClient
	sdkresolvers.BaseNameResolver
}

func OAuthClientResolver(name string, client OAuthClientClient, opts ...sdkresolvers.ResolveOption) sdkresolvers.Resolver {
	return &oAuthClientResolver{
		client:           client,
		BaseNameResolver: sdkresolvers.NewBaseNameResolver(name, "OAuthClient", opts...),
	}
}

func (r *oAuthClientResolver) Run(ctx context.Context) error {
	resp := r.client.Iterator(ctx, &iam.ListOAuthClientsRequest{
		FolderId: r.FolderID(),

		PageSize: sdkresolvers.DefaultResolverPageSize,
	})
	return r.FindName(resp.TakeAll())
}
