func (in *BucketPolicyMember) ResolveReferences(ctx context.Context, c client.Reader) error {
	r := reference.NewAPIResolver(c, in)
	rsp, err := r.Resolve(ctx, reference.ResolutionRequest{
		CurrentValue: reference.FromPtrValue(in.Spec.ForProvider.Bucket),
		Reference:    in.Spec.ForProvider.BucketRef,
		Selector:     in.Spec.ForProvider.BucketSelector,
		To:           reference.To{Managed: &v1alpha3.Bucket{}, List: &v1alpha3.BucketList{}},
		Extract:      reference.ExternalName(),
	})
	if err != nil {
		return errors.Wrap(err, "spec.forProvider.bucket")
	}
	in.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue)
	in.Spec.ForProvider.BucketRef = rsp.ResolvedReference
	rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
		CurrentValue: reference.FromPtrValue(in.Spec.ForProvider.Member),
		Reference:    in.Spec.ForProvider.ServiceAccountMemberRef,
		Selector:     in.Spec.ForProvider.ServiceAccountMemberSelector,
		To:           reference.To{Managed: &iamv1alpha1.ServiceAccount{}, List: &iamv1alpha1.ServiceAccountList{}},
		Extract:      iamv1alpha1.ServiceAccountMemberName(),
	})
	if err != nil {
		return errors.Wrap(err, "spec.forProvider.member")
	}
	in.Spec.ForProvider.Member = reference.ToPtrValue(rsp.ResolvedValue)
	in.Spec.ForProvider.ServiceAccountMemberRef = rsp.ResolvedReference
	return nil
}
ResolveReferences of this BucketPolicyMember
package v1alpha1
import (
	"context"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"github.com/crossplane/crossplane-runtime/pkg/errors"
	"github.com/crossplane/crossplane-runtime/pkg/reference"
	iamv1alpha1 "github.com/crossplane/provider-gcp/apis/iam/v1alpha1"
	"github.com/crossplane/provider-gcp/apis/storage/v1alpha3"
)
func (in *BucketPolicy) ResolveReferences(ctx context.Context, c client.Reader) error {
	r := reference.NewAPIResolver(c, in)
	rsp, err := r.Resolve(ctx, reference.ResolutionRequest{
		CurrentValue: reference.FromPtrValue(in.Spec.ForProvider.Bucket),
		Reference:    in.Spec.ForProvider.BucketRef,
		Selector:     in.Spec.ForProvider.BucketSelector,
		To:           reference.To{Managed: &v1alpha3.Bucket{}, List: &v1alpha3.BucketList{}},
		Extract:      reference.ExternalName(),
	})
	if err != nil {
		return errors.Wrap(err, "spec.forProvider.bucket")
	}
	in.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue)
	in.Spec.ForProvider.BucketRef = rsp.ResolvedReference
	for i := range in.Spec.ForProvider.Policy.Bindings {
		mrsp, err := r.ResolveMultiple(ctx, reference.MultiResolutionRequest{
			CurrentValues: in.Spec.ForProvider.Policy.Bindings[i].Members,
			References:    in.Spec.ForProvider.Policy.Bindings[i].ServiceAccountMemberRefs,
			Selector:      in.Spec.ForProvider.Policy.Bindings[i].ServiceAccountMemberSelector,
			To:            reference.To{Managed: &iamv1alpha1.ServiceAccount{}, List: &iamv1alpha1.ServiceAccountList{}},
			Extract:       iamv1alpha1.ServiceAccountMemberName(),
		})
		if err != nil {
			return errors.Wrapf(err, "spec.forProvider.Policy.Bindings[%d].Members", i)
		}
		in.Spec.ForProvider.Policy.Bindings[i].Members = mrsp.ResolvedValues
		in.Spec.ForProvider.Policy.Bindings[i].ServiceAccountMemberRefs = mrsp.ResolvedReferences
	}
	return nil
}