// 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 accessAnalyzerSubjectAccessBindingsResolver struct {
	client AccessAnalyzerClient
	sdkresolvers.BaseNameResolver
}

func AccessAnalyzerSubjectAccessBindingsResolver(name string, client AccessAnalyzerClient, opts ...sdkresolvers.ResolveOption) sdkresolvers.Resolver {
	return &accessAnalyzerSubjectAccessBindingsResolver{
		client:           client,
		BaseNameResolver: sdkresolvers.NewBaseNameResolver(name, "AccessAnalyzerSubjectAccessBindings", opts...),
	}
}

func (r *accessAnalyzerSubjectAccessBindingsResolver) Run(ctx context.Context) error {
	resp := r.client.SubjectAccessBindingsIterator(ctx, &iam.ListSubjectAccessBindingsRequest{
		OrganizationId: r.OrganizationID(),

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