// 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/iterator"
	"google.golang.org/grpc"
)

type AccessAnalyzerClientIterator interface {
	SubjectAccessBindingsIterator(context.Context, *iam.ListSubjectAccessBindingsRequest, ...grpc.CallOption) *iterator.Iterator[*iam.ListSubjectAccessBindingsRequest, *iam.SubjectAccessBinding]
}

type accessAnalyzerServiceListSubjectAccessBindingsInternal struct {
	*iam.ListSubjectAccessBindingsResponse
}

func (r accessAnalyzerServiceListSubjectAccessBindingsInternal) Items() []*iam.SubjectAccessBinding {
	return r.ListSubjectAccessBindingsResponse.SubjectAccessBindings
}

func (c accessAnalyzerClient) SubjectAccessBindingsIterator(ctx context.Context, req *iam.ListSubjectAccessBindingsRequest, opts ...grpc.CallOption) *iterator.Iterator[*iam.ListSubjectAccessBindingsRequest, *iam.SubjectAccessBinding] {
	return iterator.NewIterator[*iam.ListSubjectAccessBindingsRequest, *iam.SubjectAccessBinding](ctx, req,
		func(ctx context.Context, req *iam.ListSubjectAccessBindingsRequest, opts ...grpc.CallOption) (iterator.PageResponse[*iam.SubjectAccessBinding], error) {
			resp, err := c.ListSubjectAccessBindings(ctx, req, opts...)
			if err != nil {
				return nil, err
			}
			return accessAnalyzerServiceListSubjectAccessBindingsInternal{resp}, nil
		})
}
