From e064009b33f5367a6fabc909710efe40e3fdc730 Mon Sep 17 00:00:00 2001 From: Alper Rifat Ulucinar Date: Fri, 19 Jan 2024 17:25:17 +0300 Subject: [PATCH] Remove cross API-group imports from the zz_generated.resolvers.go files - This effectively addresses the upjet issue: https://github.com/crossplane/upjet/issues/96 for upbound/provider-aws as long as we are careful for the cross-resource reference extractors. Signed-off-by: Alper Rifat Ulucinar --- apis/acm/v1beta1/zz_generated.resolvers.go | 66 +- apis/acmpca/v1beta1/zz_generated.resolvers.go | 265 +- apis/amp/v1beta1/zz_generated.resolvers.go | 98 +- .../amplify/v1beta1/zz_generated.resolvers.go | 253 +- .../v1beta1/zz_generated.resolvers.go | 2571 +++-- .../v1beta1/zz_generated.resolvers.go | 1365 ++- .../v1beta1/zz_generated.resolvers.go | 328 +- .../v1beta1/zz_generated.resolvers.go | 1043 +- .../appflow/v1beta1/zz_generated.resolvers.go | 130 +- .../appmesh/v1beta1/zz_generated.resolvers.go | 804 +- .../v1beta1/zz_generated.resolvers.go | 313 +- .../v1beta1/zz_generated.resolvers.go | 407 +- .../appsync/v1beta1/zz_generated.resolvers.go | 603 +- apis/athena/v1beta1/zz_generated.resolvers.go | 249 +- .../v1beta1/zz_generated.resolvers.go | 897 +- apis/backup/v1beta1/zz_generated.resolvers.go | 493 +- .../budgets/v1beta1/zz_generated.resolvers.go | 190 +- apis/chime/v1beta1/zz_generated.resolvers.go | 385 +- apis/cloud9/v1beta1/zz_generated.resolvers.go | 131 +- .../v1beta1/zz_generated.resolvers.go | 70 +- .../v1beta1/zz_generated.resolvers.go | 133 +- .../v1beta1/zz_generated.resolvers.go | 639 +- .../v1beta1/zz_generated.resolvers.go | 66 +- .../v1beta1/zz_generated.resolvers.go | 261 +- .../v1beta1/zz_generated.resolvers.go | 261 +- .../v1beta1/zz_generated.resolvers.go | 673 +- .../v1beta1/zz_generated.resolvers.go | 432 +- .../v1beta1/zz_generated.resolvers.go | 192 +- .../v1beta1/zz_generated.resolvers.go | 194 +- .../v1beta1/zz_generated.resolvers.go | 130 +- .../v1beta1/zz_generated.resolvers.go | 376 +- .../v1beta1/zz_generated.resolvers.go | 1817 ++-- .../v1beta1/zz_generated.resolvers.go | 261 +- .../connect/v1beta1/zz_generated.resolvers.go | 1430 ++- apis/cur/v1beta1/zz_generated.resolvers.go | 68 +- .../v1beta1/zz_generated.resolvers.go | 68 +- .../v1beta1/zz_generated.resolvers.go | 314 +- apis/dax/v1beta1/zz_generated.resolvers.go | 190 +- apis/deploy/v1beta1/zz_generated.resolvers.go | 406 +- .../v1beta1/zz_generated.resolvers.go | 127 +- .../v1beta1/zz_generated.resolvers.go | 377 +- .../v1beta1/zz_generated.resolvers.go | 1314 ++- apis/dlm/v1beta1/zz_generated.resolvers.go | 130 +- apis/dms/v1beta1/zz_generated.resolvers.go | 894 +- apis/docdb/v1beta1/zz_generated.resolvers.go | 525 +- apis/ds/v1beta1/zz_generated.resolvers.go | 339 +- .../v1beta1/zz_generated.resolvers.go | 366 +- apis/ec2/v1beta1/zz_generated.resolvers.go | 9507 +++++++++++------ apis/ecr/v1beta1/zz_generated.resolvers.go | 190 +- .../v1beta1/zz_generated.resolvers.go | 68 +- apis/ecs/v1beta1/zz_generated.resolvers.go | 562 +- apis/efs/v1beta1/zz_generated.resolvers.go | 520 +- apis/eks/v1beta1/zz_generated.resolvers.go | 855 +- .../v1beta1/zz_generated.resolvers.go | 558 +- .../v1beta1/zz_generated.resolvers.go | 251 +- .../v1beta1/zz_generated.resolvers.go | 131 +- .../v1beta1/zz_generated.resolvers.go | 251 +- apis/elb/v1beta1/zz_generated.resolvers.go | 689 +- apis/elbv2/v1beta1/zz_generated.resolvers.go | 1048 +- .../v1beta1/zz_generated.resolvers.go | 37 +- .../v1beta1/zz_generated.resolvers.go | 1666 ++- apis/fis/v1beta1/zz_generated.resolvers.go | 70 +- apis/fsx/v1beta1/zz_generated.resolvers.go | 895 +- .../v1beta1/zz_generated.resolvers.go | 561 +- .../glacier/v1beta1/zz_generated.resolvers.go | 131 +- .../v1beta1/zz_generated.resolvers.go | 123 +- apis/glue/v1beta1/zz_generated.resolvers.go | 1170 +- .../grafana/v1beta1/zz_generated.resolvers.go | 314 +- .../v1beta1/zz_generated.resolvers.go | 161 +- apis/iam/v1beta1/zz_generated.resolvers.go | 1018 +- .../v1beta1/zz_generated.resolvers.go | 120 +- .../v1beta1/zz_generated.resolvers.go | 968 +- .../v1beta1/zz_generated.resolvers.go | 191 +- apis/iot/v1beta1/zz_generated.resolvers.go | 987 +- apis/kafka/v1beta1/zz_generated.resolvers.go | 675 +- apis/kendra/v1beta1/zz_generated.resolvers.go | 916 +- .../v1beta1/zz_generated.resolvers.go | 68 +- .../kinesis/v1beta1/zz_generated.resolvers.go | 127 +- .../v1beta1/zz_generated.resolvers.go | 377 +- .../v1beta1/zz_generated.resolvers.go | 554 +- .../v1beta1/zz_generated.resolvers.go | 66 +- apis/kms/v1beta1/zz_generated.resolvers.go | 364 +- .../v1beta1/zz_generated.resolvers.go | 254 +- apis/lambda/v1beta1/zz_generated.resolvers.go | 951 +- .../v1beta1/zz_generated.resolvers.go | 124 +- .../v1beta1/zz_generated.resolvers.go | 529 +- .../v1beta1/zz_generated.resolvers.go | 256 +- .../v1beta1/zz_generated.resolvers.go | 195 +- .../v1beta1/zz_generated.resolvers.go | 68 +- .../v1beta1/zz_generated.resolvers.go | 363 +- apis/mq/v1beta1/zz_generated.resolvers.go | 188 +- .../neptune/v1beta1/zz_generated.resolvers.go | 961 +- .../v1beta1/zz_generated.resolvers.go | 425 +- .../v1beta1/zz_generated.resolvers.go | 1458 ++- .../v1beta1/zz_generated.resolvers.go | 192 +- .../v1beta1/zz_generated.resolvers.go | 2215 ++-- .../v1beta1/zz_generated.resolvers.go | 125 +- .../v1beta1/zz_generated.resolvers.go | 66 +- apis/qldb/v1beta1/zz_generated.resolvers.go | 251 +- apis/ram/v1beta1/zz_generated.resolvers.go | 258 +- apis/rds/v1beta1/zz_generated.resolvers.go | 2419 +++-- .../v1beta1/zz_generated.resolvers.go | 711 +- .../v1beta1/zz_generated.resolvers.go | 643 +- .../v1beta1/zz_generated.resolvers.go | 70 +- .../route53/v1beta1/zz_generated.resolvers.go | 783 +- .../v1beta1/zz_generated.resolvers.go | 286 +- .../v1beta1/zz_generated.resolvers.go | 70 +- .../v1beta1/zz_generated.resolvers.go | 306 +- apis/rum/v1beta1/zz_generated.resolvers.go | 128 +- apis/s3/v1beta1/zz_generated.resolvers.go | 1884 ++-- .../v1beta1/zz_generated.resolvers.go | 472 +- .../v1beta1/zz_generated.resolvers.go | 1905 ++-- .../v1beta1/zz_generated.resolvers.go | 191 +- .../schemas/v1beta1/zz_generated.resolvers.go | 129 +- .../v1beta1/zz_generated.resolvers.go | 302 +- .../v1beta1/zz_generated.resolvers.go | 66 +- .../v1beta1/zz_generated.resolvers.go | 755 +- .../v1beta1/zz_generated.resolvers.go | 127 +- apis/ses/v1beta1/zz_generated.resolvers.go | 502 +- apis/sesv2/v1beta1/zz_generated.resolvers.go | 375 +- apis/sfn/v1beta1/zz_generated.resolvers.go | 70 +- apis/signer/v1beta1/zz_generated.resolvers.go | 156 +- apis/sns/v1beta1/zz_generated.resolvers.go | 1039 +- apis/sqs/v1beta1/zz_generated.resolvers.go | 200 +- apis/ssm/v1beta1/zz_generated.resolvers.go | 831 +- .../v1beta1/zz_generated.resolvers.go | 317 +- .../v1beta1/zz_generated.resolvers.go | 97 +- .../v1beta1/zz_generated.resolvers.go | 72 +- .../v1beta1/zz_generated.resolvers.go | 614 +- apis/waf/v1beta1/zz_generated.resolvers.go | 323 +- .../v1beta1/zz_generated.resolvers.go | 313 +- .../v1beta1/zz_generated.resolvers.go | 188 +- apis/xray/v1beta1/zz_generated.resolvers.go | 66 +- 133 files changed, 49379 insertions(+), 24743 deletions(-) diff --git a/apis/acm/v1beta1/zz_generated.resolvers.go b/apis/acm/v1beta1/zz_generated.resolvers.go index e4942ca14e..712c3b3dbc 100644 --- a/apis/acm/v1beta1/zz_generated.resolvers.go +++ b/apis/acm/v1beta1/zz_generated.resolvers.go @@ -8,43 +8,67 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this CertificateValidation. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this CertificateValidation. func (mg *CertificateValidation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CertificateArnRef, - Selector: mg.Spec.ForProvider.CertificateArnSelector, - To: reference.To{ - List: &CertificateList{}, - Managed: &Certificate{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CertificateArnRef, + Selector: mg.Spec.ForProvider.CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CertificateArn") } mg.Spec.ForProvider.CertificateArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CertificateArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CertificateArnRef, - Selector: mg.Spec.InitProvider.CertificateArnSelector, - To: reference.To{ - List: &CertificateList{}, - Managed: &Certificate{}, - }, - }) + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CertificateArnRef, + Selector: mg.Spec.InitProvider.CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CertificateArn") } diff --git a/apis/acmpca/v1beta1/zz_generated.resolvers.go b/apis/acmpca/v1beta1/zz_generated.resolvers.go index e4a826c9f6..8b9a1753e3 100644 --- a/apis/acmpca/v1beta1/zz_generated.resolvers.go +++ b/apis/acmpca/v1beta1/zz_generated.resolvers.go @@ -8,44 +8,72 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Certificate. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Certificate. func (mg *Certificate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acmpca.aws.upbound.io", + + "v1beta1", + + "CertificateAuthority", + + "CertificateAuthorityList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateAuthorityArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CertificateAuthorityArnRef, - Selector: mg.Spec.ForProvider.CertificateAuthorityArnSelector, - To: reference.To{ - List: &CertificateAuthorityList{}, - Managed: &CertificateAuthority{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateAuthorityArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CertificateAuthorityArnRef, + Selector: mg.Spec.ForProvider.CertificateAuthorityArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CertificateAuthorityArn") } mg.Spec.ForProvider.CertificateAuthorityArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CertificateAuthorityArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acmpca.aws.upbound.io", + + "v1beta1", + + "CertificateAuthority", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateAuthorityArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CertificateAuthorityArnRef, - Selector: mg.Spec.InitProvider.CertificateAuthorityArnSelector, - To: reference.To{ - List: &CertificateAuthorityList{}, - Managed: &CertificateAuthority{}, - }, - }) + "CertificateAuthorityList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateAuthorityArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CertificateAuthorityArnRef, + Selector: mg.Spec.InitProvider.CertificateAuthorityArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CertificateAuthorityArn") } @@ -57,37 +85,62 @@ func (mg *Certificate) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this CertificateAuthorityCertificate. func (mg *CertificateAuthorityCertificate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acmpca.aws.upbound.io", + + "v1beta1", + + "CertificateAuthority", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateAuthorityArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CertificateAuthorityArnRef, - Selector: mg.Spec.ForProvider.CertificateAuthorityArnSelector, - To: reference.To{ - List: &CertificateAuthorityList{}, - Managed: &CertificateAuthority{}, - }, - }) + "CertificateAuthorityList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateAuthorityArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CertificateAuthorityArnRef, + Selector: mg.Spec.ForProvider.CertificateAuthorityArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CertificateAuthorityArn") } mg.Spec.ForProvider.CertificateAuthorityArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CertificateAuthorityArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acmpca.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateAuthorityArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CertificateAuthorityArnRef, - Selector: mg.Spec.InitProvider.CertificateAuthorityArnSelector, - To: reference.To{ - List: &CertificateAuthorityList{}, - Managed: &CertificateAuthority{}, - }, - }) + "v1beta1", + + "CertificateAuthority", + + "CertificateAuthorityList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateAuthorityArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CertificateAuthorityArnRef, + Selector: mg.Spec.InitProvider.CertificateAuthorityArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CertificateAuthorityArn") } @@ -99,37 +152,62 @@ func (mg *CertificateAuthorityCertificate) ResolveReferences(ctx context.Context // ResolveReferences of this Permission. func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acmpca.aws.upbound.io", + + "v1beta1", + + "CertificateAuthority", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateAuthorityArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CertificateAuthorityArnRef, - Selector: mg.Spec.ForProvider.CertificateAuthorityArnSelector, - To: reference.To{ - List: &CertificateAuthorityList{}, - Managed: &CertificateAuthority{}, - }, - }) + "CertificateAuthorityList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateAuthorityArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CertificateAuthorityArnRef, + Selector: mg.Spec.ForProvider.CertificateAuthorityArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CertificateAuthorityArn") } mg.Spec.ForProvider.CertificateAuthorityArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CertificateAuthorityArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acmpca.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateAuthorityArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.CertificateAuthorityArnRef, - Selector: mg.Spec.InitProvider.CertificateAuthorityArnSelector, - To: reference.To{ - List: &CertificateAuthorityList{}, - Managed: &CertificateAuthority{}, - }, - }) + "v1beta1", + + "CertificateAuthority", + + "CertificateAuthorityList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateAuthorityArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.CertificateAuthorityArnRef, + Selector: mg.Spec.InitProvider.CertificateAuthorityArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CertificateAuthorityArn") } @@ -141,37 +219,62 @@ func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Policy. func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acmpca.aws.upbound.io", + + "v1beta1", + + "CertificateAuthority", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceArnRef, - Selector: mg.Spec.ForProvider.ResourceArnSelector, - To: reference.To{ - List: &CertificateAuthorityList{}, - Managed: &CertificateAuthority{}, - }, - }) + "CertificateAuthorityList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceArnRef, + Selector: mg.Spec.ForProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceArn") } mg.Spec.ForProvider.ResourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acmpca.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceArnRef, - Selector: mg.Spec.InitProvider.ResourceArnSelector, - To: reference.To{ - List: &CertificateAuthorityList{}, - Managed: &CertificateAuthority{}, - }, - }) + "v1beta1", + + "CertificateAuthority", + + "CertificateAuthorityList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceArnRef, + Selector: mg.Spec.InitProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceArn") } diff --git a/apis/amp/v1beta1/zz_generated.resolvers.go b/apis/amp/v1beta1/zz_generated.resolvers.go index 4c6243d144..f7246280e9 100644 --- a/apis/amp/v1beta1/zz_generated.resolvers.go +++ b/apis/amp/v1beta1/zz_generated.resolvers.go @@ -10,42 +10,66 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AlertManagerDefinition. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this AlertManagerDefinition. func (mg *AlertManagerDefinition) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("amp.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WorkspaceIDRef, - Selector: mg.Spec.ForProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WorkspaceIDRef, + Selector: mg.Spec.ForProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WorkspaceID") } mg.Spec.ForProvider.WorkspaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.WorkspaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("amp.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.WorkspaceIDRef, - Selector: mg.Spec.InitProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.WorkspaceIDRef, + Selector: mg.Spec.InitProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WorkspaceID") } @@ -57,21 +81,33 @@ func (mg *AlertManagerDefinition) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this RuleGroupNamespace. func (mg *RuleGroupNamespace) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("amp.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WorkspaceIDRef, - Selector: mg.Spec.ForProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + "v1beta1", + + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WorkspaceIDRef, + Selector: mg.Spec.ForProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WorkspaceID") } diff --git a/apis/amplify/v1beta1/zz_generated.resolvers.go b/apis/amplify/v1beta1/zz_generated.resolvers.go index 4bbb2d03e6..e0396bea23 100644 --- a/apis/amplify/v1beta1/zz_generated.resolvers.go +++ b/apis/amplify/v1beta1/zz_generated.resolvers.go @@ -10,44 +10,70 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this App. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this App. func (mg *App) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMServiceRoleArnRef, - Selector: mg.Spec.ForProvider.IAMServiceRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMServiceRoleArnRef, + Selector: mg.Spec.ForProvider.IAMServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMServiceRoleArn") } mg.Spec.ForProvider.IAMServiceRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IAMServiceRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMServiceRoleArnRef, - Selector: mg.Spec.InitProvider.IAMServiceRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMServiceRoleArnRef, + Selector: mg.Spec.InitProvider.IAMServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMServiceRoleArn") } @@ -59,21 +85,33 @@ func (mg *App) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this BackendEnvironment. func (mg *BackendEnvironment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("amplify.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AppIDRef, - Selector: mg.Spec.ForProvider.AppIDSelector, - To: reference.To{ - List: &AppList{}, - Managed: &App{}, - }, - }) + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AppIDRef, + Selector: mg.Spec.ForProvider.AppIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AppID") } @@ -85,21 +123,33 @@ func (mg *BackendEnvironment) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this Branch. func (mg *Branch) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("amplify.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AppIDRef, - Selector: mg.Spec.ForProvider.AppIDSelector, - To: reference.To{ - List: &AppList{}, - Managed: &App{}, - }, - }) + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AppIDRef, + Selector: mg.Spec.ForProvider.AppIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AppID") } @@ -111,69 +161,108 @@ func (mg *Branch) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Webhook. func (mg *Webhook) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("amplify.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AppIDRef, - Selector: mg.Spec.ForProvider.AppIDSelector, - To: reference.To{ - List: &AppList{}, - Managed: &App{}, - }, - }) + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AppIDRef, + Selector: mg.Spec.ForProvider.AppIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AppID") } mg.Spec.ForProvider.AppID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AppIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("amplify.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BranchName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.BranchNameRef, - Selector: mg.Spec.ForProvider.BranchNameSelector, - To: reference.To{ - List: &BranchList{}, - Managed: &Branch{}, - }, - }) + "Branch", + "BranchList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BranchName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.BranchNameRef, + Selector: mg.Spec.ForProvider.BranchNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BranchName") } mg.Spec.ForProvider.BranchName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BranchNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("amplify.aws.upbound.io", + + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AppID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.AppIDRef, - Selector: mg.Spec.InitProvider.AppIDSelector, - To: reference.To{ - List: &AppList{}, - Managed: &App{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AppID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.AppIDRef, + Selector: mg.Spec.InitProvider.AppIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AppID") } mg.Spec.InitProvider.AppID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AppIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("amplify.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BranchName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.BranchNameRef, - Selector: mg.Spec.InitProvider.BranchNameSelector, - To: reference.To{ - List: &BranchList{}, - Managed: &Branch{}, - }, - }) + "Branch", + "BranchList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BranchName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.BranchNameRef, + Selector: mg.Spec.InitProvider.BranchNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BranchName") } diff --git a/apis/apigateway/v1beta1/zz_generated.resolvers.go b/apis/apigateway/v1beta1/zz_generated.resolvers.go index 41984586bf..28f21a8d73 100644 --- a/apis/apigateway/v1beta1/zz_generated.resolvers.go +++ b/apis/apigateway/v1beta1/zz_generated.resolvers.go @@ -10,47 +10,70 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/acm/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/lambda/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Account. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Account. func (mg *Account) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.CloudwatchRoleArnRef, - Selector: mg.Spec.ForProvider.CloudwatchRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.CloudwatchRoleArnRef, + Selector: mg.Spec.ForProvider.CloudwatchRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CloudwatchRoleArn") } mg.Spec.ForProvider.CloudwatchRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CloudwatchRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.CloudwatchRoleArnRef, - Selector: mg.Spec.InitProvider.CloudwatchRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.CloudwatchRoleArnRef, + Selector: mg.Spec.InitProvider.CloudwatchRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CloudwatchRoleArn") } @@ -62,101 +85,162 @@ func (mg *Account) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Authorizer. func (mg *Authorizer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerCredentials), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.AuthorizerCredentialsRef, - Selector: mg.Spec.ForProvider.AuthorizerCredentialsSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerCredentials), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.AuthorizerCredentialsRef, + Selector: mg.Spec.ForProvider.AuthorizerCredentialsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AuthorizerCredentials") } mg.Spec.ForProvider.AuthorizerCredentials = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AuthorizerCredentialsRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerURI), - Extract: resource.ExtractParamPath("invoke_arn", true), - Reference: mg.Spec.ForProvider.AuthorizerURIRef, - Selector: mg.Spec.ForProvider.AuthorizerURISelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerURI), + Extract: resource.ExtractParamPath("invoke_arn", true), + Reference: mg.Spec.ForProvider.AuthorizerURIRef, + Selector: mg.Spec.ForProvider.AuthorizerURISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AuthorizerURI") } mg.Spec.ForProvider.AuthorizerURI = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AuthorizerURIRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerCredentials), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.AuthorizerCredentialsRef, - Selector: mg.Spec.InitProvider.AuthorizerCredentialsSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerCredentials), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.AuthorizerCredentialsRef, + Selector: mg.Spec.InitProvider.AuthorizerCredentialsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AuthorizerCredentials") } mg.Spec.InitProvider.AuthorizerCredentials = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AuthorizerCredentialsRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerURI), - Extract: resource.ExtractParamPath("invoke_arn", true), - Reference: mg.Spec.InitProvider.AuthorizerURIRef, - Selector: mg.Spec.InitProvider.AuthorizerURISelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerURI), + Extract: resource.ExtractParamPath("invoke_arn", true), + Reference: mg.Spec.InitProvider.AuthorizerURIRef, + Selector: mg.Spec.InitProvider.AuthorizerURISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AuthorizerURI") } mg.Spec.InitProvider.AuthorizerURI = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AuthorizerURIRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -168,101 +252,160 @@ func (mg *Authorizer) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this BasePathMapping. func (mg *BasePathMapping) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "DomainName", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), - Extract: resource.ExtractParamPath("domain_name", false), - Reference: mg.Spec.ForProvider.DomainNameRef, - Selector: mg.Spec.ForProvider.DomainNameSelector, - To: reference.To{ - List: &DomainNameList{}, - Managed: &DomainName{}, - }, - }) + "DomainNameList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), + Extract: resource.ExtractParamPath("domain_name", false), + Reference: mg.Spec.ForProvider.DomainNameRef, + Selector: mg.Spec.ForProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainName") } mg.Spec.ForProvider.DomainName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StageName), - Extract: resource.ExtractParamPath("stage_name", false), - Reference: mg.Spec.ForProvider.StageNameRef, - Selector: mg.Spec.ForProvider.StageNameSelector, - To: reference.To{ - List: &StageList{}, - Managed: &Stage{}, - }, - }) + "Stage", + "StageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StageName), + Extract: resource.ExtractParamPath("stage_name", false), + Reference: mg.Spec.ForProvider.StageNameRef, + Selector: mg.Spec.ForProvider.StageNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StageName") } mg.Spec.ForProvider.StageName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StageNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "DomainName", + + "DomainNameList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), - Extract: resource.ExtractParamPath("domain_name", false), - Reference: mg.Spec.InitProvider.DomainNameRef, - Selector: mg.Spec.InitProvider.DomainNameSelector, - To: reference.To{ - List: &DomainNameList{}, - Managed: &DomainName{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), + Extract: resource.ExtractParamPath("domain_name", false), + Reference: mg.Spec.InitProvider.DomainNameRef, + Selector: mg.Spec.InitProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainName") } mg.Spec.InitProvider.DomainName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DomainNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Stage", + "StageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StageName), - Extract: resource.ExtractParamPath("stage_name", false), - Reference: mg.Spec.InitProvider.StageNameRef, - Selector: mg.Spec.InitProvider.StageNameSelector, - To: reference.To{ - List: &StageList{}, - Managed: &Stage{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StageName), + Extract: resource.ExtractParamPath("stage_name", false), + Reference: mg.Spec.InitProvider.StageNameRef, + Selector: mg.Spec.InitProvider.StageNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StageName") } @@ -274,37 +417,60 @@ func (mg *BasePathMapping) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this Deployment. func (mg *Deployment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -316,37 +482,60 @@ func (mg *Deployment) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this DocumentationPart. func (mg *DocumentationPart) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -358,37 +547,60 @@ func (mg *DocumentationPart) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this DocumentationVersion. func (mg *DocumentationVersion) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -400,69 +612,116 @@ func (mg *DocumentationVersion) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this DomainName. func (mg *DomainName) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateArn), - Extract: resource.ExtractParamPath("certificate_arn", false), - Reference: mg.Spec.ForProvider.CertificateArnRef, - Selector: mg.Spec.ForProvider.CertificateArnSelector, - To: reference.To{ - List: &v1beta12.CertificateValidationList{}, - Managed: &v1beta12.CertificateValidation{}, - }, - }) + "CertificateValidation", + + "CertificateValidationList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateArn), + Extract: resource.ExtractParamPath("certificate_arn", false), + Reference: mg.Spec.ForProvider.CertificateArnRef, + Selector: mg.Spec.ForProvider.CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CertificateArn") } mg.Spec.ForProvider.CertificateArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CertificateArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "CertificateValidation", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegionalCertificateArn), - Extract: resource.ExtractParamPath("certificate_arn", false), - Reference: mg.Spec.ForProvider.RegionalCertificateArnRef, - Selector: mg.Spec.ForProvider.RegionalCertificateArnSelector, - To: reference.To{ - List: &v1beta12.CertificateValidationList{}, - Managed: &v1beta12.CertificateValidation{}, - }, - }) + "CertificateValidationList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegionalCertificateArn), + Extract: resource.ExtractParamPath("certificate_arn", false), + Reference: mg.Spec.ForProvider.RegionalCertificateArnRef, + Selector: mg.Spec.ForProvider.RegionalCertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RegionalCertificateArn") } mg.Spec.ForProvider.RegionalCertificateArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RegionalCertificateArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateArn), - Extract: resource.ExtractParamPath("certificate_arn", false), - Reference: mg.Spec.InitProvider.CertificateArnRef, - Selector: mg.Spec.InitProvider.CertificateArnSelector, - To: reference.To{ - List: &v1beta12.CertificateValidationList{}, - Managed: &v1beta12.CertificateValidation{}, - }, - }) + "CertificateValidation", + + "CertificateValidationList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateArn), + Extract: resource.ExtractParamPath("certificate_arn", false), + Reference: mg.Spec.InitProvider.CertificateArnRef, + Selector: mg.Spec.InitProvider.CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CertificateArn") } mg.Spec.InitProvider.CertificateArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CertificateArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegionalCertificateArn), - Extract: resource.ExtractParamPath("certificate_arn", false), - Reference: mg.Spec.InitProvider.RegionalCertificateArnRef, - Selector: mg.Spec.InitProvider.RegionalCertificateArnSelector, - To: reference.To{ - List: &v1beta12.CertificateValidationList{}, - Managed: &v1beta12.CertificateValidation{}, - }, - }) + "v1beta1", + + "CertificateValidation", + + "CertificateValidationList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegionalCertificateArn), + Extract: resource.ExtractParamPath("certificate_arn", false), + Reference: mg.Spec.InitProvider.RegionalCertificateArnRef, + Selector: mg.Spec.InitProvider.RegionalCertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RegionalCertificateArn") } @@ -474,37 +733,60 @@ func (mg *DomainName) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this GatewayResponse. func (mg *GatewayResponse) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -516,165 +798,264 @@ func (mg *GatewayResponse) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this Integration. func (mg *Integration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &VPCLinkList{}, - Managed: &VPCLink{}, - }, - }) + "v1beta1", + + "VPCLink", + + "VPCLinkList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPMethod), - Extract: resource.ExtractParamPath("http_method", false), - Reference: mg.Spec.ForProvider.HTTPMethodRef, - Selector: mg.Spec.ForProvider.HTTPMethodSelector, - To: reference.To{ - List: &MethodList{}, - Managed: &Method{}, - }, - }) + "Method", + "MethodList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPMethod), + Extract: resource.ExtractParamPath("http_method", false), + Reference: mg.Spec.ForProvider.HTTPMethodRef, + Selector: mg.Spec.ForProvider.HTTPMethodSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HTTPMethod") } mg.Spec.ForProvider.HTTPMethod = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HTTPMethodRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + "Resource", + + "ResourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.URI), - Extract: resource.ExtractParamPath("invoke_arn", true), - Reference: mg.Spec.ForProvider.URIRef, - Selector: mg.Spec.ForProvider.URISelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.URI), + Extract: resource.ExtractParamPath("invoke_arn", true), + Reference: mg.Spec.ForProvider.URIRef, + Selector: mg.Spec.ForProvider.URISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.URI") } mg.Spec.ForProvider.URI = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.URIRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "VPCLink", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &VPCLinkList{}, - Managed: &VPCLink{}, - }, - }) + "VPCLinkList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } mg.Spec.InitProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConnectionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPMethod), - Extract: resource.ExtractParamPath("http_method", false), - Reference: mg.Spec.InitProvider.HTTPMethodRef, - Selector: mg.Spec.InitProvider.HTTPMethodSelector, - To: reference.To{ - List: &MethodList{}, - Managed: &Method{}, - }, - }) + "v1beta1", + + "Method", + "MethodList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPMethod), + Extract: resource.ExtractParamPath("http_method", false), + Reference: mg.Spec.InitProvider.HTTPMethodRef, + Selector: mg.Spec.InitProvider.HTTPMethodSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HTTPMethod") } mg.Spec.InitProvider.HTTPMethod = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.HTTPMethodRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ResourceIDRef, - Selector: mg.Spec.InitProvider.ResourceIDSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + "v1beta1", + + "Resource", + + "ResourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ResourceIDRef, + Selector: mg.Spec.InitProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceID") } mg.Spec.InitProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } mg.Spec.InitProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.URI), - Extract: resource.ExtractParamPath("invoke_arn", true), - Reference: mg.Spec.InitProvider.URIRef, - Selector: mg.Spec.InitProvider.URISelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.URI), + Extract: resource.ExtractParamPath("invoke_arn", true), + Reference: mg.Spec.InitProvider.URIRef, + Selector: mg.Spec.InitProvider.URISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.URI") } @@ -686,133 +1067,212 @@ func (mg *Integration) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this IntegrationResponse. func (mg *IntegrationResponse) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPMethod), - Extract: resource.ExtractParamPath("http_method", false), - Reference: mg.Spec.ForProvider.HTTPMethodRef, - Selector: mg.Spec.ForProvider.HTTPMethodSelector, - To: reference.To{ - List: &MethodList{}, - Managed: &Method{}, - }, - }) + "v1beta1", + + "Method", + "MethodList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPMethod), + Extract: resource.ExtractParamPath("http_method", false), + Reference: mg.Spec.ForProvider.HTTPMethodRef, + Selector: mg.Spec.ForProvider.HTTPMethodSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HTTPMethod") } mg.Spec.ForProvider.HTTPMethod = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HTTPMethodRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Resource", + + "ResourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StatusCode), - Extract: resource.ExtractParamPath("status_code", false), - Reference: mg.Spec.ForProvider.StatusCodeRef, - Selector: mg.Spec.ForProvider.StatusCodeSelector, - To: reference.To{ - List: &MethodResponseList{}, - Managed: &MethodResponse{}, - }, - }) + "MethodResponse", + + "MethodResponseList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StatusCode), + Extract: resource.ExtractParamPath("status_code", false), + Reference: mg.Spec.ForProvider.StatusCodeRef, + Selector: mg.Spec.ForProvider.StatusCodeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StatusCode") } mg.Spec.ForProvider.StatusCode = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StatusCodeRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Method", + "MethodList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPMethod), - Extract: resource.ExtractParamPath("http_method", false), - Reference: mg.Spec.InitProvider.HTTPMethodRef, - Selector: mg.Spec.InitProvider.HTTPMethodSelector, - To: reference.To{ - List: &MethodList{}, - Managed: &Method{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPMethod), + Extract: resource.ExtractParamPath("http_method", false), + Reference: mg.Spec.InitProvider.HTTPMethodRef, + Selector: mg.Spec.InitProvider.HTTPMethodSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HTTPMethod") } mg.Spec.InitProvider.HTTPMethod = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.HTTPMethodRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ResourceIDRef, - Selector: mg.Spec.InitProvider.ResourceIDSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + "Resource", + + "ResourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ResourceIDRef, + Selector: mg.Spec.InitProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceID") } mg.Spec.InitProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } mg.Spec.InitProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "MethodResponse", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StatusCode), - Extract: resource.ExtractParamPath("status_code", false), - Reference: mg.Spec.InitProvider.StatusCodeRef, - Selector: mg.Spec.InitProvider.StatusCodeSelector, - To: reference.To{ - List: &MethodResponseList{}, - Managed: &MethodResponse{}, - }, - }) + "MethodResponseList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StatusCode), + Extract: resource.ExtractParamPath("status_code", false), + Reference: mg.Spec.InitProvider.StatusCodeRef, + Selector: mg.Spec.InitProvider.StatusCodeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StatusCode") } @@ -824,101 +1284,162 @@ func (mg *IntegrationResponse) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this Method. func (mg *Method) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AuthorizerIDRef, - Selector: mg.Spec.ForProvider.AuthorizerIDSelector, - To: reference.To{ - List: &AuthorizerList{}, - Managed: &Authorizer{}, - }, - }) + "v1beta1", + + "Authorizer", + + "AuthorizerList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AuthorizerIDRef, + Selector: mg.Spec.ForProvider.AuthorizerIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AuthorizerID") } mg.Spec.ForProvider.AuthorizerID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AuthorizerIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Resource", + + "ResourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Authorizer", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.AuthorizerIDRef, - Selector: mg.Spec.InitProvider.AuthorizerIDSelector, - To: reference.To{ - List: &AuthorizerList{}, - Managed: &Authorizer{}, - }, - }) + "AuthorizerList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.AuthorizerIDRef, + Selector: mg.Spec.InitProvider.AuthorizerIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AuthorizerID") } mg.Spec.InitProvider.AuthorizerID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AuthorizerIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ResourceIDRef, - Selector: mg.Spec.InitProvider.ResourceIDSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + "v1beta1", + + "Resource", + + "ResourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ResourceIDRef, + Selector: mg.Spec.InitProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceID") } mg.Spec.InitProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -930,101 +1451,162 @@ func (mg *Method) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this MethodResponse. func (mg *MethodResponse) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Method", + "MethodList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPMethod), - Extract: resource.ExtractParamPath("http_method", false), - Reference: mg.Spec.ForProvider.HTTPMethodRef, - Selector: mg.Spec.ForProvider.HTTPMethodSelector, - To: reference.To{ - List: &MethodList{}, - Managed: &Method{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPMethod), + Extract: resource.ExtractParamPath("http_method", false), + Reference: mg.Spec.ForProvider.HTTPMethodRef, + Selector: mg.Spec.ForProvider.HTTPMethodSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HTTPMethod") } mg.Spec.ForProvider.HTTPMethod = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HTTPMethodRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Resource", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + "ResourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Method", + "MethodList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPMethod), - Extract: resource.ExtractParamPath("http_method", false), - Reference: mg.Spec.InitProvider.HTTPMethodRef, - Selector: mg.Spec.InitProvider.HTTPMethodSelector, - To: reference.To{ - List: &MethodList{}, - Managed: &Method{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPMethod), + Extract: resource.ExtractParamPath("http_method", false), + Reference: mg.Spec.InitProvider.HTTPMethodRef, + Selector: mg.Spec.InitProvider.HTTPMethodSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HTTPMethod") } mg.Spec.InitProvider.HTTPMethod = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.HTTPMethodRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Resource", + + "ResourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ResourceIDRef, - Selector: mg.Spec.InitProvider.ResourceIDSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ResourceIDRef, + Selector: mg.Spec.InitProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceID") } mg.Spec.InitProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -1036,69 +1618,110 @@ func (mg *MethodResponse) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this MethodSettings. func (mg *MethodSettings) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Stage", + "StageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StageName), - Extract: resource.ExtractParamPath("stage_name", false), - Reference: mg.Spec.ForProvider.StageNameRef, - Selector: mg.Spec.ForProvider.StageNameSelector, - To: reference.To{ - List: &StageList{}, - Managed: &Stage{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StageName), + Extract: resource.ExtractParamPath("stage_name", false), + Reference: mg.Spec.ForProvider.StageNameRef, + Selector: mg.Spec.ForProvider.StageNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StageName") } mg.Spec.ForProvider.StageName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StageNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } mg.Spec.InitProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Stage", + "StageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StageName), - Extract: resource.ExtractParamPath("stage_name", false), - Reference: mg.Spec.InitProvider.StageNameRef, - Selector: mg.Spec.InitProvider.StageNameSelector, - To: reference.To{ - List: &StageList{}, - Managed: &Stage{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StageName), + Extract: resource.ExtractParamPath("stage_name", false), + Reference: mg.Spec.InitProvider.StageNameRef, + Selector: mg.Spec.InitProvider.StageNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StageName") } @@ -1110,37 +1733,60 @@ func (mg *MethodSettings) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this Model. func (mg *Model) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -1152,37 +1798,60 @@ func (mg *Model) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this RequestValidator. func (mg *RequestValidator) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -1194,69 +1863,112 @@ func (mg *RequestValidator) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this Resource. func (mg *Resource) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ParentID), - Extract: resource.ExtractParamPath("root_resource_id", true), - Reference: mg.Spec.ForProvider.ParentIDRef, - Selector: mg.Spec.ForProvider.ParentIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ParentID), + Extract: resource.ExtractParamPath("root_resource_id", true), + Reference: mg.Spec.ForProvider.ParentIDRef, + Selector: mg.Spec.ForProvider.ParentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ParentID") } mg.Spec.ForProvider.ParentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ParentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ParentID), - Extract: resource.ExtractParamPath("root_resource_id", true), - Reference: mg.Spec.InitProvider.ParentIDRef, - Selector: mg.Spec.InitProvider.ParentIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ParentID), + Extract: resource.ExtractParamPath("root_resource_id", true), + Reference: mg.Spec.InitProvider.ParentIDRef, + Selector: mg.Spec.InitProvider.ParentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ParentID") } mg.Spec.InitProvider.ParentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ParentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -1268,37 +1980,60 @@ func (mg *Resource) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this RestAPIPolicy. func (mg *RestAPIPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -1310,69 +2045,110 @@ func (mg *RestAPIPolicy) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Stage. func (mg *Stage) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Deployment", + + "DeploymentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeploymentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DeploymentIDRef, - Selector: mg.Spec.ForProvider.DeploymentIDSelector, - To: reference.To{ - List: &DeploymentList{}, - Managed: &Deployment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeploymentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DeploymentIDRef, + Selector: mg.Spec.ForProvider.DeploymentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeploymentID") } mg.Spec.ForProvider.DeploymentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeploymentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RestAPIIDRef, - Selector: mg.Spec.ForProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RestAPIIDRef, + Selector: mg.Spec.ForProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestAPIID") } mg.Spec.ForProvider.RestAPIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RestAPIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Deployment", + + "DeploymentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeploymentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DeploymentIDRef, - Selector: mg.Spec.InitProvider.DeploymentIDSelector, - To: reference.To{ - List: &DeploymentList{}, - Managed: &Deployment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeploymentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DeploymentIDRef, + Selector: mg.Spec.InitProvider.DeploymentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DeploymentID") } mg.Spec.InitProvider.DeploymentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DeploymentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RestAPIIDRef, - Selector: mg.Spec.InitProvider.RestAPIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestAPIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RestAPIIDRef, + Selector: mg.Spec.InitProvider.RestAPIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestAPIID") } @@ -1384,22 +2160,36 @@ func (mg *Stage) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this UsagePlan. func (mg *UsagePlan) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.APIStages); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIStages[i3].APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.APIStages[i3].APIIDRef, - Selector: mg.Spec.ForProvider.APIStages[i3].APIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIStages[i3].APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.APIStages[i3].APIIDRef, + Selector: mg.Spec.ForProvider.APIStages[i3].APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIStages[i3].APIID") } @@ -1408,16 +2198,26 @@ func (mg *UsagePlan) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.APIStages); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIStages[i3].Stage), - Extract: resource.ExtractParamPath("stage_name", false), - Reference: mg.Spec.ForProvider.APIStages[i3].StageRef, - Selector: mg.Spec.ForProvider.APIStages[i3].StageSelector, - To: reference.To{ - List: &StageList{}, - Managed: &Stage{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Stage", + "StageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIStages[i3].Stage), + Extract: resource.ExtractParamPath("stage_name", false), + Reference: mg.Spec.ForProvider.APIStages[i3].StageRef, + Selector: mg.Spec.ForProvider.APIStages[i3].StageSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIStages[i3].Stage") } @@ -1426,16 +2226,27 @@ func (mg *UsagePlan) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.APIStages); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIStages[i3].APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.APIStages[i3].APIIDRef, - Selector: mg.Spec.InitProvider.APIStages[i3].APIIDSelector, - To: reference.To{ - List: &RestAPIList{}, - Managed: &RestAPI{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "RestAPI", + + "RestAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIStages[i3].APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.APIStages[i3].APIIDRef, + Selector: mg.Spec.InitProvider.APIStages[i3].APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIStages[i3].APIID") } @@ -1444,16 +2255,26 @@ func (mg *UsagePlan) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.APIStages); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIStages[i3].Stage), - Extract: resource.ExtractParamPath("stage_name", false), - Reference: mg.Spec.InitProvider.APIStages[i3].StageRef, - Selector: mg.Spec.InitProvider.APIStages[i3].StageSelector, - To: reference.To{ - List: &StageList{}, - Managed: &Stage{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "Stage", + "StageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIStages[i3].Stage), + Extract: resource.ExtractParamPath("stage_name", false), + Reference: mg.Spec.InitProvider.APIStages[i3].StageRef, + Selector: mg.Spec.InitProvider.APIStages[i3].StageSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIStages[i3].Stage") } @@ -1467,69 +2288,110 @@ func (mg *UsagePlan) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this UsagePlanKey. func (mg *UsagePlanKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "APIKey", + "APIKeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.KeyIDRef, - Selector: mg.Spec.ForProvider.KeyIDSelector, - To: reference.To{ - List: &APIKeyList{}, - Managed: &APIKey{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.KeyIDRef, + Selector: mg.Spec.ForProvider.KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KeyID") } mg.Spec.ForProvider.KeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "UsagePlan", + + "UsagePlanList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UsagePlanID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.UsagePlanIDRef, - Selector: mg.Spec.ForProvider.UsagePlanIDSelector, - To: reference.To{ - List: &UsagePlanList{}, - Managed: &UsagePlan{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UsagePlanID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.UsagePlanIDRef, + Selector: mg.Spec.ForProvider.UsagePlanIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UsagePlanID") } mg.Spec.ForProvider.UsagePlanID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UsagePlanIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "APIKey", + "APIKeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.KeyIDRef, - Selector: mg.Spec.InitProvider.KeyIDSelector, - To: reference.To{ - List: &APIKeyList{}, - Managed: &APIKey{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.KeyIDRef, + Selector: mg.Spec.InitProvider.KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KeyID") } mg.Spec.InitProvider.KeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigateway.aws.upbound.io", + + "v1beta1", + + "UsagePlan", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UsagePlanID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.UsagePlanIDRef, - Selector: mg.Spec.InitProvider.UsagePlanIDSelector, - To: reference.To{ - List: &UsagePlanList{}, - Managed: &UsagePlan{}, - }, - }) + "UsagePlanList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UsagePlanID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.UsagePlanIDRef, + Selector: mg.Spec.InitProvider.UsagePlanIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UsagePlanID") } @@ -1541,37 +2403,56 @@ func (mg *UsagePlanKey) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this VPCLink. func (mg *VPCLink) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LB", + "LBList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.TargetArns), - Extract: common.ARNExtractor(), - References: mg.Spec.ForProvider.TargetArnRefs, - Selector: mg.Spec.ForProvider.TargetArnSelector, - To: reference.To{ - List: &v1beta13.LBList{}, - Managed: &v1beta13.LB{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.TargetArns), + Extract: common.ARNExtractor(), + References: mg.Spec.ForProvider.TargetArnRefs, + Selector: mg.Spec.ForProvider.TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetArns") } mg.Spec.ForProvider.TargetArns = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.TargetArnRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LB", + "LBList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.TargetArns), - Extract: common.ARNExtractor(), - References: mg.Spec.InitProvider.TargetArnRefs, - Selector: mg.Spec.InitProvider.TargetArnSelector, - To: reference.To{ - List: &v1beta13.LBList{}, - Managed: &v1beta13.LB{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.TargetArns), + Extract: common.ARNExtractor(), + References: mg.Spec.InitProvider.TargetArnRefs, + Selector: mg.Spec.InitProvider.TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetArns") } diff --git a/apis/apigatewayv2/v1beta1/zz_generated.resolvers.go b/apis/apigatewayv2/v1beta1/zz_generated.resolvers.go index a725642475..dbc1632919 100644 --- a/apis/apigatewayv2/v1beta1/zz_generated.resolvers.go +++ b/apis/apigatewayv2/v1beta1/zz_generated.resolvers.go @@ -10,113 +10,168 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/acm/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" apis "github.com/upbound/provider-aws/config/common/apis" lambda "github.com/upbound/provider-aws/config/common/apis/lambda" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this APIMapping. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this APIMapping. func (mg *APIMapping) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DomainNameRef, - Selector: mg.Spec.ForProvider.DomainNameSelector, - To: reference.To{ - List: &DomainNameList{}, - Managed: &DomainName{}, - }, - }) + "DomainName", + + "DomainNameList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DomainNameRef, + Selector: mg.Spec.ForProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainName") } mg.Spec.ForProvider.DomainName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "Stage", + "StageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Stage), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.StageRef, - Selector: mg.Spec.ForProvider.StageSelector, - To: reference.To{ - List: &StageList{}, - Managed: &Stage{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Stage), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.StageRef, + Selector: mg.Spec.ForProvider.StageSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Stage") } mg.Spec.ForProvider.Stage = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StageRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DomainNameRef, - Selector: mg.Spec.InitProvider.DomainNameSelector, - To: reference.To{ - List: &DomainNameList{}, - Managed: &DomainName{}, - }, - }) + "DomainName", + + "DomainNameList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DomainNameRef, + Selector: mg.Spec.InitProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainName") } mg.Spec.InitProvider.DomainName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DomainNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Stage), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.StageRef, - Selector: mg.Spec.InitProvider.StageSelector, - To: reference.To{ - List: &StageList{}, - Managed: &Stage{}, - }, - }) + "Stage", + "StageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Stage), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.StageRef, + Selector: mg.Spec.InitProvider.StageSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Stage") } @@ -128,69 +183,106 @@ func (mg *APIMapping) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Authorizer. func (mg *Authorizer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerURI), - Extract: lambda.FunctionInvokeARN(), - Reference: mg.Spec.ForProvider.AuthorizerURIRef, - Selector: mg.Spec.ForProvider.AuthorizerURISelector, - To: reference.To{ - List: &v1beta1.FunctionList{}, - Managed: &v1beta1.Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerURI), + Extract: lambda.FunctionInvokeARN(), + Reference: mg.Spec.ForProvider.AuthorizerURIRef, + Selector: mg.Spec.ForProvider.AuthorizerURISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AuthorizerURI") } mg.Spec.ForProvider.AuthorizerURI = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AuthorizerURIRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerURI), - Extract: lambda.FunctionInvokeARN(), - Reference: mg.Spec.InitProvider.AuthorizerURIRef, - Selector: mg.Spec.InitProvider.AuthorizerURISelector, - To: reference.To{ - List: &v1beta1.FunctionList{}, - Managed: &v1beta1.Function{}, - }, - }) + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerURI), + Extract: lambda.FunctionInvokeARN(), + Reference: mg.Spec.InitProvider.AuthorizerURIRef, + Selector: mg.Spec.InitProvider.AuthorizerURISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AuthorizerURI") } @@ -202,37 +294,56 @@ func (mg *Authorizer) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Deployment. func (mg *Deployment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } @@ -244,22 +355,35 @@ func (mg *Deployment) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this DomainName. func (mg *DomainName) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.DomainNameConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainNameConfiguration[i3].CertificateArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.DomainNameConfiguration[i3].CertificateArnRef, - Selector: mg.Spec.ForProvider.DomainNameConfiguration[i3].CertificateArnSelector, - To: reference.To{ - List: &v1beta11.CertificateList{}, - Managed: &v1beta11.Certificate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainNameConfiguration[i3].CertificateArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.DomainNameConfiguration[i3].CertificateArnRef, + Selector: mg.Spec.ForProvider.DomainNameConfiguration[i3].CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainNameConfiguration[i3].CertificateArn") } @@ -268,16 +392,26 @@ func (mg *DomainName) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.InitProvider.DomainNameConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainNameConfiguration[i3].CertificateArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.DomainNameConfiguration[i3].CertificateArnRef, - Selector: mg.Spec.InitProvider.DomainNameConfiguration[i3].CertificateArnSelector, - To: reference.To{ - List: &v1beta11.CertificateList{}, - Managed: &v1beta11.Certificate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainNameConfiguration[i3].CertificateArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.DomainNameConfiguration[i3].CertificateArnRef, + Selector: mg.Spec.InitProvider.DomainNameConfiguration[i3].CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainNameConfiguration[i3].CertificateArn") } @@ -291,133 +425,210 @@ func (mg *DomainName) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Integration. func (mg *Integration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &VPCLinkList{}, - Managed: &VPCLink{}, - }, - }) + "v1beta1", + + "VPCLink", + + "VPCLinkList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CredentialsArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CredentialsArnRef, - Selector: mg.Spec.ForProvider.CredentialsArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CredentialsArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CredentialsArnRef, + Selector: mg.Spec.ForProvider.CredentialsArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CredentialsArn") } mg.Spec.ForProvider.CredentialsArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CredentialsArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IntegrationURI), - Extract: resource.ExtractParamPath("invoke_arn", true), - Reference: mg.Spec.ForProvider.IntegrationURIRef, - Selector: mg.Spec.ForProvider.IntegrationURISelector, - To: reference.To{ - List: &v1beta1.FunctionList{}, - Managed: &v1beta1.Function{}, - }, - }) + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IntegrationURI), + Extract: resource.ExtractParamPath("invoke_arn", true), + Reference: mg.Spec.ForProvider.IntegrationURIRef, + Selector: mg.Spec.ForProvider.IntegrationURISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IntegrationURI") } mg.Spec.ForProvider.IntegrationURI = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IntegrationURIRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "VPCLink", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &VPCLinkList{}, - Managed: &VPCLink{}, - }, - }) + "VPCLinkList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } mg.Spec.InitProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConnectionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CredentialsArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.CredentialsArnRef, - Selector: mg.Spec.InitProvider.CredentialsArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CredentialsArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.CredentialsArnRef, + Selector: mg.Spec.InitProvider.CredentialsArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CredentialsArn") } mg.Spec.InitProvider.CredentialsArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CredentialsArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IntegrationURI), - Extract: resource.ExtractParamPath("invoke_arn", true), - Reference: mg.Spec.InitProvider.IntegrationURIRef, - Selector: mg.Spec.InitProvider.IntegrationURISelector, - To: reference.To{ - List: &v1beta1.FunctionList{}, - Managed: &v1beta1.Function{}, - }, - }) + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IntegrationURI), + Extract: resource.ExtractParamPath("invoke_arn", true), + Reference: mg.Spec.InitProvider.IntegrationURIRef, + Selector: mg.Spec.InitProvider.IntegrationURISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IntegrationURI") } @@ -429,69 +640,106 @@ func (mg *Integration) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this IntegrationResponse. func (mg *IntegrationResponse) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "Integration", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IntegrationID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.IntegrationIDRef, - Selector: mg.Spec.ForProvider.IntegrationIDSelector, - To: reference.To{ - List: &IntegrationList{}, - Managed: &Integration{}, - }, - }) + "IntegrationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IntegrationID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.IntegrationIDRef, + Selector: mg.Spec.ForProvider.IntegrationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IntegrationID") } mg.Spec.ForProvider.IntegrationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IntegrationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "Integration", + + "IntegrationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IntegrationID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.IntegrationIDRef, - Selector: mg.Spec.InitProvider.IntegrationIDSelector, - To: reference.To{ - List: &IntegrationList{}, - Managed: &Integration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IntegrationID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.IntegrationIDRef, + Selector: mg.Spec.InitProvider.IntegrationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IntegrationID") } @@ -503,37 +751,56 @@ func (mg *IntegrationResponse) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this Model. func (mg *Model) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } @@ -545,101 +812,156 @@ func (mg *Model) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this Route. func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AuthorizerIDRef, - Selector: mg.Spec.ForProvider.AuthorizerIDSelector, - To: reference.To{ - List: &AuthorizerList{}, - Managed: &Authorizer{}, - }, - }) + "Authorizer", + + "AuthorizerList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthorizerID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AuthorizerIDRef, + Selector: mg.Spec.ForProvider.AuthorizerIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AuthorizerID") } mg.Spec.ForProvider.AuthorizerID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AuthorizerIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target), - Extract: apis.IntegrationIDPrefixed(), - Reference: mg.Spec.ForProvider.TargetRef, - Selector: mg.Spec.ForProvider.TargetSelector, - To: reference.To{ - List: &IntegrationList{}, - Managed: &Integration{}, - }, - }) + "Integration", + + "IntegrationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target), + Extract: apis.IntegrationIDPrefixed(), + Reference: mg.Spec.ForProvider.TargetRef, + Selector: mg.Spec.ForProvider.TargetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Target") } mg.Spec.ForProvider.Target = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "Authorizer", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.AuthorizerIDRef, - Selector: mg.Spec.InitProvider.AuthorizerIDSelector, - To: reference.To{ - List: &AuthorizerList{}, - Managed: &Authorizer{}, - }, - }) + "AuthorizerList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AuthorizerID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.AuthorizerIDRef, + Selector: mg.Spec.InitProvider.AuthorizerIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AuthorizerID") } mg.Spec.InitProvider.AuthorizerID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AuthorizerIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "Integration", + + "IntegrationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target), - Extract: apis.IntegrationIDPrefixed(), - Reference: mg.Spec.InitProvider.TargetRef, - Selector: mg.Spec.InitProvider.TargetSelector, - To: reference.To{ - List: &IntegrationList{}, - Managed: &Integration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target), + Extract: apis.IntegrationIDPrefixed(), + Reference: mg.Spec.InitProvider.TargetRef, + Selector: mg.Spec.InitProvider.TargetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Target") } @@ -651,69 +973,106 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this RouteResponse. func (mg *RouteResponse) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "Route", + "RouteList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RouteIDRef, - Selector: mg.Spec.ForProvider.RouteIDSelector, - To: reference.To{ - List: &RouteList{}, - Managed: &Route{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RouteIDRef, + Selector: mg.Spec.ForProvider.RouteIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RouteID") } mg.Spec.ForProvider.RouteID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RouteIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RouteIDRef, - Selector: mg.Spec.InitProvider.RouteIDSelector, - To: reference.To{ - List: &RouteList{}, - Managed: &Route{}, - }, - }) + "v1beta1", + + "Route", + "RouteList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RouteIDRef, + Selector: mg.Spec.InitProvider.RouteIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RouteID") } @@ -725,69 +1084,106 @@ func (mg *RouteResponse) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Stage. func (mg *Stage) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeploymentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DeploymentIDRef, - Selector: mg.Spec.ForProvider.DeploymentIDSelector, - To: reference.To{ - List: &DeploymentList{}, - Managed: &Deployment{}, - }, - }) + "Deployment", + + "DeploymentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeploymentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DeploymentIDRef, + Selector: mg.Spec.ForProvider.DeploymentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeploymentID") } mg.Spec.ForProvider.DeploymentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeploymentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "API", "APIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &APIList{}, - Managed: &API{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("apigatewayv2.aws.upbound.io", + + "v1beta1", + + "Deployment", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeploymentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DeploymentIDRef, - Selector: mg.Spec.InitProvider.DeploymentIDSelector, - To: reference.To{ - List: &DeploymentList{}, - Managed: &Deployment{}, - }, - }) + "DeploymentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeploymentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DeploymentIDRef, + Selector: mg.Spec.InitProvider.DeploymentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DeploymentID") } @@ -799,69 +1195,108 @@ func (mg *Stage) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this VPCLink. func (mg *VPCLink) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/appautoscaling/v1beta1/zz_generated.resolvers.go b/apis/appautoscaling/v1beta1/zz_generated.resolvers.go index 12a3a17fa2..c73e69590e 100644 --- a/apis/appautoscaling/v1beta1/zz_generated.resolvers.go +++ b/apis/appautoscaling/v1beta1/zz_generated.resolvers.go @@ -10,60 +10,90 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Policy. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Policy. func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", + + "v1beta1", + "Target", + + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: resource.ExtractParamPath("resource_id", false), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: resource.ExtractParamPath("resource_id", false), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", + + "v1beta1", + "Target", + + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ScalableDimension), - Extract: resource.ExtractParamPath("scalable_dimension", false), - Reference: mg.Spec.ForProvider.ScalableDimensionRef, - Selector: mg.Spec.ForProvider.ScalableDimensionSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ScalableDimension), + Extract: resource.ExtractParamPath("scalable_dimension", false), + Reference: mg.Spec.ForProvider.ScalableDimensionRef, + Selector: mg.Spec.ForProvider.ScalableDimensionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ScalableDimension") } mg.Spec.ForProvider.ScalableDimension = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ScalableDimensionRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", + + "v1beta1", + "Target", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceNamespace), - Extract: resource.ExtractParamPath("service_namespace", false), - Reference: mg.Spec.ForProvider.ServiceNamespaceRef, - Selector: mg.Spec.ForProvider.ServiceNamespaceSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceNamespace), + Extract: resource.ExtractParamPath("service_namespace", false), + Reference: mg.Spec.ForProvider.ServiceNamespaceRef, + Selector: mg.Spec.ForProvider.ServiceNamespaceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceNamespace") } @@ -75,101 +105,152 @@ func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ScheduledAction. func (mg *ScheduledAction) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", + + "v1beta1", + "Target", + + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: resource.ExtractParamPath("resource_id", false), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: resource.ExtractParamPath("resource_id", false), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", + + "v1beta1", + "Target", + + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ScalableDimension), - Extract: resource.ExtractParamPath("scalable_dimension", false), - Reference: mg.Spec.ForProvider.ScalableDimensionRef, - Selector: mg.Spec.ForProvider.ScalableDimensionSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ScalableDimension), + Extract: resource.ExtractParamPath("scalable_dimension", false), + Reference: mg.Spec.ForProvider.ScalableDimensionRef, + Selector: mg.Spec.ForProvider.ScalableDimensionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ScalableDimension") } mg.Spec.ForProvider.ScalableDimension = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ScalableDimensionRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", + + "v1beta1", + "Target", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceNamespace), - Extract: resource.ExtractParamPath("service_namespace", false), - Reference: mg.Spec.ForProvider.ServiceNamespaceRef, - Selector: mg.Spec.ForProvider.ServiceNamespaceSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceNamespace), + Extract: resource.ExtractParamPath("service_namespace", false), + Reference: mg.Spec.ForProvider.ServiceNamespaceRef, + Selector: mg.Spec.ForProvider.ServiceNamespaceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceNamespace") } mg.Spec.ForProvider.ServiceNamespace = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServiceNamespaceRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", + + "v1beta1", + "Target", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), - Extract: resource.ExtractParamPath("resource_id", false), - Reference: mg.Spec.InitProvider.ResourceIDRef, - Selector: mg.Spec.InitProvider.ResourceIDSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), + Extract: resource.ExtractParamPath("resource_id", false), + Reference: mg.Spec.InitProvider.ResourceIDRef, + Selector: mg.Spec.InitProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceID") } mg.Spec.InitProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ScalableDimension), - Extract: resource.ExtractParamPath("scalable_dimension", false), - Reference: mg.Spec.InitProvider.ScalableDimensionRef, - Selector: mg.Spec.InitProvider.ScalableDimensionSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + "v1beta1", + "Target", + + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ScalableDimension), + Extract: resource.ExtractParamPath("scalable_dimension", false), + Reference: mg.Spec.InitProvider.ScalableDimensionRef, + Selector: mg.Spec.InitProvider.ScalableDimensionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ScalableDimension") } mg.Spec.InitProvider.ScalableDimension = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ScalableDimensionRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appautoscaling.aws.upbound.io", + + "v1beta1", + "Target", + + "TargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceNamespace), - Extract: resource.ExtractParamPath("service_namespace", false), - Reference: mg.Spec.InitProvider.ServiceNamespaceRef, - Selector: mg.Spec.InitProvider.ServiceNamespaceSelector, - To: reference.To{ - List: &TargetList{}, - Managed: &Target{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceNamespace), + Extract: resource.ExtractParamPath("service_namespace", false), + Reference: mg.Spec.InitProvider.ServiceNamespaceRef, + Selector: mg.Spec.InitProvider.ServiceNamespaceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceNamespace") } @@ -181,37 +262,60 @@ func (mg *ScheduledAction) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this Target. func (mg *Target) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/appconfig/v1beta1/zz_generated.resolvers.go b/apis/appconfig/v1beta1/zz_generated.resolvers.go index 7535b080dc..9c470cc7f0 100644 --- a/apis/appconfig/v1beta1/zz_generated.resolvers.go +++ b/apis/appconfig/v1beta1/zz_generated.resolvers.go @@ -10,79 +10,120 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/cloudwatch/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ConfigurationProfile. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ConfigurationProfile. func (mg *ConfigurationProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Application", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ApplicationIDRef, - Selector: mg.Spec.ForProvider.ApplicationIDSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ApplicationIDRef, + Selector: mg.Spec.ForProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationID") } mg.Spec.ForProvider.ApplicationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApplicationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RetrievalRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RetrievalRoleArnRef, - Selector: mg.Spec.ForProvider.RetrievalRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RetrievalRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RetrievalRoleArnRef, + Selector: mg.Spec.ForProvider.RetrievalRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RetrievalRoleArn") } mg.Spec.ForProvider.RetrievalRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RetrievalRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ApplicationIDRef, - Selector: mg.Spec.InitProvider.ApplicationIDSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "v1beta1", + + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ApplicationIDRef, + Selector: mg.Spec.InitProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationID") } mg.Spec.InitProvider.ApplicationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ApplicationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RetrievalRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RetrievalRoleArnRef, - Selector: mg.Spec.InitProvider.RetrievalRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RetrievalRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RetrievalRoleArnRef, + Selector: mg.Spec.InitProvider.RetrievalRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RetrievalRoleArn") } @@ -94,197 +135,316 @@ func (mg *ConfigurationProfile) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this Deployment. func (mg *Deployment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ApplicationIDRef, - Selector: mg.Spec.ForProvider.ApplicationIDSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ApplicationIDRef, + Selector: mg.Spec.ForProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationID") } mg.Spec.ForProvider.ApplicationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApplicationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "ConfigurationProfile", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationProfileID), - Extract: resource.ExtractParamPath("configuration_profile_id", true), - Reference: mg.Spec.ForProvider.ConfigurationProfileIDRef, - Selector: mg.Spec.ForProvider.ConfigurationProfileIDSelector, - To: reference.To{ - List: &ConfigurationProfileList{}, - Managed: &ConfigurationProfile{}, - }, - }) + "ConfigurationProfileList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationProfileID), + Extract: resource.ExtractParamPath("configuration_profile_id", true), + Reference: mg.Spec.ForProvider.ConfigurationProfileIDRef, + Selector: mg.Spec.ForProvider.ConfigurationProfileIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationProfileID") } mg.Spec.ForProvider.ConfigurationProfileID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConfigurationProfileIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "HostedConfigurationVersion", + + "HostedConfigurationVersionList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationVersion), - Extract: resource.ExtractParamPath("version_number", true), - Reference: mg.Spec.ForProvider.ConfigurationVersionRef, - Selector: mg.Spec.ForProvider.ConfigurationVersionSelector, - To: reference.To{ - List: &HostedConfigurationVersionList{}, - Managed: &HostedConfigurationVersion{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationVersion), + Extract: resource.ExtractParamPath("version_number", true), + Reference: mg.Spec.ForProvider.ConfigurationVersionRef, + Selector: mg.Spec.ForProvider.ConfigurationVersionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationVersion") } mg.Spec.ForProvider.ConfigurationVersion = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConfigurationVersionRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "DeploymentStrategy", + + "DeploymentStrategyList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeploymentStrategyID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DeploymentStrategyIDRef, - Selector: mg.Spec.ForProvider.DeploymentStrategyIDSelector, - To: reference.To{ - List: &DeploymentStrategyList{}, - Managed: &DeploymentStrategy{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeploymentStrategyID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DeploymentStrategyIDRef, + Selector: mg.Spec.ForProvider.DeploymentStrategyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeploymentStrategyID") } mg.Spec.ForProvider.DeploymentStrategyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeploymentStrategyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Environment", + + "EnvironmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EnvironmentID), - Extract: resource.ExtractParamPath("environment_id", true), - Reference: mg.Spec.ForProvider.EnvironmentIDRef, - Selector: mg.Spec.ForProvider.EnvironmentIDSelector, - To: reference.To{ - List: &EnvironmentList{}, - Managed: &Environment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EnvironmentID), + Extract: resource.ExtractParamPath("environment_id", true), + Reference: mg.Spec.ForProvider.EnvironmentIDRef, + Selector: mg.Spec.ForProvider.EnvironmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EnvironmentID") } mg.Spec.ForProvider.EnvironmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EnvironmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.KMSKeyIdentifierRef, - Selector: mg.Spec.ForProvider.KMSKeyIdentifierSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.KMSKeyIdentifierRef, + Selector: mg.Spec.ForProvider.KMSKeyIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyIdentifier") } mg.Spec.ForProvider.KMSKeyIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ApplicationIDRef, - Selector: mg.Spec.InitProvider.ApplicationIDSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ApplicationIDRef, + Selector: mg.Spec.InitProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationID") } mg.Spec.InitProvider.ApplicationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ApplicationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "ConfigurationProfile", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationProfileID), - Extract: resource.ExtractParamPath("configuration_profile_id", true), - Reference: mg.Spec.InitProvider.ConfigurationProfileIDRef, - Selector: mg.Spec.InitProvider.ConfigurationProfileIDSelector, - To: reference.To{ - List: &ConfigurationProfileList{}, - Managed: &ConfigurationProfile{}, - }, - }) + "ConfigurationProfileList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationProfileID), + Extract: resource.ExtractParamPath("configuration_profile_id", true), + Reference: mg.Spec.InitProvider.ConfigurationProfileIDRef, + Selector: mg.Spec.InitProvider.ConfigurationProfileIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConfigurationProfileID") } mg.Spec.InitProvider.ConfigurationProfileID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConfigurationProfileIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationVersion), - Extract: resource.ExtractParamPath("version_number", true), - Reference: mg.Spec.InitProvider.ConfigurationVersionRef, - Selector: mg.Spec.InitProvider.ConfigurationVersionSelector, - To: reference.To{ - List: &HostedConfigurationVersionList{}, - Managed: &HostedConfigurationVersion{}, - }, - }) + "v1beta1", + + "HostedConfigurationVersion", + + "HostedConfigurationVersionList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationVersion), + Extract: resource.ExtractParamPath("version_number", true), + Reference: mg.Spec.InitProvider.ConfigurationVersionRef, + Selector: mg.Spec.InitProvider.ConfigurationVersionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConfigurationVersion") } mg.Spec.InitProvider.ConfigurationVersion = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConfigurationVersionRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeploymentStrategyID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DeploymentStrategyIDRef, - Selector: mg.Spec.InitProvider.DeploymentStrategyIDSelector, - To: reference.To{ - List: &DeploymentStrategyList{}, - Managed: &DeploymentStrategy{}, - }, - }) + "DeploymentStrategy", + + "DeploymentStrategyList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeploymentStrategyID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DeploymentStrategyIDRef, + Selector: mg.Spec.InitProvider.DeploymentStrategyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DeploymentStrategyID") } mg.Spec.InitProvider.DeploymentStrategyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DeploymentStrategyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Environment", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EnvironmentID), - Extract: resource.ExtractParamPath("environment_id", true), - Reference: mg.Spec.InitProvider.EnvironmentIDRef, - Selector: mg.Spec.InitProvider.EnvironmentIDSelector, - To: reference.To{ - List: &EnvironmentList{}, - Managed: &Environment{}, - }, - }) + "EnvironmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EnvironmentID), + Extract: resource.ExtractParamPath("environment_id", true), + Reference: mg.Spec.InitProvider.EnvironmentIDRef, + Selector: mg.Spec.InitProvider.EnvironmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EnvironmentID") } mg.Spec.InitProvider.EnvironmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.EnvironmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.KMSKeyIdentifierRef, - Selector: mg.Spec.InitProvider.KMSKeyIdentifierSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.KMSKeyIdentifierRef, + Selector: mg.Spec.InitProvider.KMSKeyIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyIdentifier") } @@ -296,21 +456,33 @@ func (mg *Deployment) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Environment. func (mg *Environment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ApplicationIDRef, - Selector: mg.Spec.ForProvider.ApplicationIDSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ApplicationIDRef, + Selector: mg.Spec.ForProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationID") } @@ -318,16 +490,26 @@ func (mg *Environment) ResolveReferences(ctx context.Context, c client.Reader) e mg.Spec.ForProvider.ApplicationIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.Monitor); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Monitor[i3].AlarmArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Monitor[i3].AlarmArnRef, - Selector: mg.Spec.ForProvider.Monitor[i3].AlarmArnSelector, - To: reference.To{ - List: &v1beta12.MetricAlarmList{}, - Managed: &v1beta12.MetricAlarm{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatch.aws.upbound.io", + + "v1beta1", + + "MetricAlarm", + + "MetricAlarmList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Monitor[i3].AlarmArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Monitor[i3].AlarmArnRef, + Selector: mg.Spec.ForProvider.Monitor[i3].AlarmArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Monitor[i3].AlarmArn") } @@ -336,16 +518,27 @@ func (mg *Environment) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.ForProvider.Monitor); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Monitor[i3].AlarmRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Monitor[i3].AlarmRoleArnRef, - Selector: mg.Spec.ForProvider.Monitor[i3].AlarmRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Monitor[i3].AlarmRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Monitor[i3].AlarmRoleArnRef, + Selector: mg.Spec.ForProvider.Monitor[i3].AlarmRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Monitor[i3].AlarmRoleArn") } @@ -353,16 +546,26 @@ func (mg *Environment) ResolveReferences(ctx context.Context, c client.Reader) e mg.Spec.ForProvider.Monitor[i3].AlarmRoleArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ApplicationIDRef, - Selector: mg.Spec.InitProvider.ApplicationIDSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ApplicationIDRef, + Selector: mg.Spec.InitProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationID") } @@ -370,16 +573,26 @@ func (mg *Environment) ResolveReferences(ctx context.Context, c client.Reader) e mg.Spec.InitProvider.ApplicationIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.Monitor); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Monitor[i3].AlarmArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Monitor[i3].AlarmArnRef, - Selector: mg.Spec.InitProvider.Monitor[i3].AlarmArnSelector, - To: reference.To{ - List: &v1beta12.MetricAlarmList{}, - Managed: &v1beta12.MetricAlarm{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatch.aws.upbound.io", + + "v1beta1", + + "MetricAlarm", + + "MetricAlarmList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Monitor[i3].AlarmArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Monitor[i3].AlarmArnRef, + Selector: mg.Spec.InitProvider.Monitor[i3].AlarmArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Monitor[i3].AlarmArn") } @@ -388,16 +601,27 @@ func (mg *Environment) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.Monitor); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Monitor[i3].AlarmRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Monitor[i3].AlarmRoleArnRef, - Selector: mg.Spec.InitProvider.Monitor[i3].AlarmRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Monitor[i3].AlarmRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Monitor[i3].AlarmRoleArnRef, + Selector: mg.Spec.InitProvider.Monitor[i3].AlarmRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Monitor[i3].AlarmRoleArn") } @@ -411,6 +635,9 @@ func (mg *Environment) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Extension. func (mg *Extension) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -418,16 +645,27 @@ func (mg *Extension) ResolveReferences(ctx context.Context, c client.Reader) err for i3 := 0; i3 < len(mg.Spec.ForProvider.ActionPoint); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ActionPoint[i3].Action); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ActionPoint[i3].Action[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ActionPoint[i3].Action[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.ActionPoint[i3].Action[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ActionPoint[i3].Action[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ActionPoint[i3].Action[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.ActionPoint[i3].Action[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ActionPoint[i3].Action[i4].RoleArn") } @@ -438,16 +676,26 @@ func (mg *Extension) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.ActionPoint); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ActionPoint[i3].Action); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ActionPoint[i3].Action[i4].URI), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ActionPoint[i3].Action[i4].URIRef, - Selector: mg.Spec.ForProvider.ActionPoint[i3].Action[i4].URISelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ActionPoint[i3].Action[i4].URI), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ActionPoint[i3].Action[i4].URIRef, + Selector: mg.Spec.ForProvider.ActionPoint[i3].Action[i4].URISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ActionPoint[i3].Action[i4].URI") } @@ -458,16 +706,27 @@ func (mg *Extension) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.ActionPoint); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ActionPoint[i3].Action); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ActionPoint[i3].Action[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ActionPoint[i3].Action[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.ActionPoint[i3].Action[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ActionPoint[i3].Action[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ActionPoint[i3].Action[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.ActionPoint[i3].Action[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ActionPoint[i3].Action[i4].RoleArn") } @@ -478,16 +737,26 @@ func (mg *Extension) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.ActionPoint); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ActionPoint[i3].Action); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ActionPoint[i3].Action[i4].URI), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ActionPoint[i3].Action[i4].URIRef, - Selector: mg.Spec.InitProvider.ActionPoint[i3].Action[i4].URISelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ActionPoint[i3].Action[i4].URI), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ActionPoint[i3].Action[i4].URIRef, + Selector: mg.Spec.InitProvider.ActionPoint[i3].Action[i4].URISelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ActionPoint[i3].Action[i4].URI") } @@ -502,69 +771,110 @@ func (mg *Extension) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this ExtensionAssociation. func (mg *ExtensionAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Extension", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtensionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ExtensionArnRef, - Selector: mg.Spec.ForProvider.ExtensionArnSelector, - To: reference.To{ - List: &ExtensionList{}, - Managed: &Extension{}, - }, - }) + "ExtensionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtensionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ExtensionArnRef, + Selector: mg.Spec.ForProvider.ExtensionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExtensionArn") } mg.Spec.ForProvider.ExtensionArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ExtensionArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Application", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceArnRef, - Selector: mg.Spec.ForProvider.ResourceArnSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceArnRef, + Selector: mg.Spec.ForProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceArn") } mg.Spec.ForProvider.ResourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Extension", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtensionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ExtensionArnRef, - Selector: mg.Spec.InitProvider.ExtensionArnSelector, - To: reference.To{ - List: &ExtensionList{}, - Managed: &Extension{}, - }, - }) + "ExtensionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtensionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ExtensionArnRef, + Selector: mg.Spec.InitProvider.ExtensionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExtensionArn") } mg.Spec.InitProvider.ExtensionArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ExtensionArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Application", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceArnRef, - Selector: mg.Spec.InitProvider.ResourceArnSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceArnRef, + Selector: mg.Spec.InitProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceArn") } @@ -576,69 +886,112 @@ func (mg *ExtensionAssociation) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this HostedConfigurationVersion. func (mg *HostedConfigurationVersion) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ApplicationIDRef, - Selector: mg.Spec.ForProvider.ApplicationIDSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ApplicationIDRef, + Selector: mg.Spec.ForProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationID") } mg.Spec.ForProvider.ApplicationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApplicationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "ConfigurationProfile", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationProfileID), - Extract: resource.ExtractParamPath("configuration_profile_id", true), - Reference: mg.Spec.ForProvider.ConfigurationProfileIDRef, - Selector: mg.Spec.ForProvider.ConfigurationProfileIDSelector, - To: reference.To{ - List: &ConfigurationProfileList{}, - Managed: &ConfigurationProfile{}, - }, - }) + "ConfigurationProfileList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationProfileID), + Extract: resource.ExtractParamPath("configuration_profile_id", true), + Reference: mg.Spec.ForProvider.ConfigurationProfileIDRef, + Selector: mg.Spec.ForProvider.ConfigurationProfileIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationProfileID") } mg.Spec.ForProvider.ConfigurationProfileID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConfigurationProfileIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ApplicationIDRef, - Selector: mg.Spec.InitProvider.ApplicationIDSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ApplicationIDRef, + Selector: mg.Spec.InitProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationID") } mg.Spec.InitProvider.ApplicationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ApplicationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appconfig.aws.upbound.io", + + "v1beta1", + + "ConfigurationProfile", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationProfileID), - Extract: resource.ExtractParamPath("configuration_profile_id", true), - Reference: mg.Spec.InitProvider.ConfigurationProfileIDRef, - Selector: mg.Spec.InitProvider.ConfigurationProfileIDSelector, - To: reference.To{ - List: &ConfigurationProfileList{}, - Managed: &ConfigurationProfile{}, - }, - }) + "ConfigurationProfileList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationProfileID), + Extract: resource.ExtractParamPath("configuration_profile_id", true), + Reference: mg.Spec.InitProvider.ConfigurationProfileIDRef, + Selector: mg.Spec.InitProvider.ConfigurationProfileIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConfigurationProfileID") } diff --git a/apis/appflow/v1beta1/zz_generated.resolvers.go b/apis/appflow/v1beta1/zz_generated.resolvers.go index 0b9a4886ea..f2c9b9ad7e 100644 --- a/apis/appflow/v1beta1/zz_generated.resolvers.go +++ b/apis/appflow/v1beta1/zz_generated.resolvers.go @@ -10,12 +10,18 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Flow. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Flow. func (mg *Flow) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -24,16 +30,26 @@ func (mg *Flow) ResolveReferences(ctx context.Context, c client.Reader) error { for i3 := 0; i3 < len(mg.Spec.ForProvider.DestinationFlowConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketName), - Extract: resource.ExtractParamPath("bucket", false), - Reference: mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketNameRef, - Selector: mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketNameSelector, - To: reference.To{ - List: &v1beta1.BucketPolicyList{}, - Managed: &v1beta1.BucketPolicy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "BucketPolicy", + "BucketPolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketName), + Extract: resource.ExtractParamPath("bucket", false), + Reference: mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketNameRef, + Selector: mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketName") } @@ -46,16 +62,26 @@ func (mg *Flow) ResolveReferences(ctx context.Context, c client.Reader) error { for i3 := 0; i3 < len(mg.Spec.ForProvider.SourceFlowConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketName), - Extract: resource.ExtractParamPath("bucket", false), - Reference: mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketNameRef, - Selector: mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketNameSelector, - To: reference.To{ - List: &v1beta1.BucketPolicyList{}, - Managed: &v1beta1.BucketPolicy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "BucketPolicy", + "BucketPolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketName), + Extract: resource.ExtractParamPath("bucket", false), + Reference: mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketNameRef, + Selector: mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketName") } @@ -68,16 +94,26 @@ func (mg *Flow) ResolveReferences(ctx context.Context, c client.Reader) error { for i3 := 0; i3 < len(mg.Spec.InitProvider.DestinationFlowConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketName), - Extract: resource.ExtractParamPath("bucket", false), - Reference: mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketNameRef, - Selector: mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketNameSelector, - To: reference.To{ - List: &v1beta1.BucketPolicyList{}, - Managed: &v1beta1.BucketPolicy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "BucketPolicy", + "BucketPolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketName), + Extract: resource.ExtractParamPath("bucket", false), + Reference: mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketNameRef, + Selector: mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DestinationFlowConfig[i3].DestinationConnectorProperties[i4].S3[i5].BucketName") } @@ -90,16 +126,26 @@ func (mg *Flow) ResolveReferences(ctx context.Context, c client.Reader) error { for i3 := 0; i3 < len(mg.Spec.InitProvider.SourceFlowConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketName), - Extract: resource.ExtractParamPath("bucket", false), - Reference: mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketNameRef, - Selector: mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketNameSelector, - To: reference.To{ - List: &v1beta1.BucketPolicyList{}, - Managed: &v1beta1.BucketPolicy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "BucketPolicy", + "BucketPolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketName), + Extract: resource.ExtractParamPath("bucket", false), + Reference: mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketNameRef, + Selector: mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceFlowConfig[i3].SourceConnectorProperties[i4].S3[i5].BucketName") } diff --git a/apis/appmesh/v1beta1/zz_generated.resolvers.go b/apis/appmesh/v1beta1/zz_generated.resolvers.go index 73347bf51b..9b839f1557 100644 --- a/apis/appmesh/v1beta1/zz_generated.resolvers.go +++ b/apis/appmesh/v1beta1/zz_generated.resolvers.go @@ -10,13 +10,18 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/acm/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/servicediscovery/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this GatewayRoute. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this GatewayRoute. func (mg *GatewayRoute) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -27,16 +32,26 @@ func (mg *GatewayRoute) ResolveReferences(ctx context.Context, c client.Reader) for i5 := 0; i5 < len(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target); i6++ { for i7 := 0; i7 < len(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService); i7++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceNameRef, - Selector: mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceNameSelector, - To: reference.To{ - List: &VirtualServiceList{}, - Managed: &VirtualService{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualService", + + "VirtualServiceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceNameRef, + Selector: mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceName") } @@ -48,16 +63,26 @@ func (mg *GatewayRoute) ResolveReferences(ctx context.Context, c client.Reader) } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualGatewayName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.VirtualGatewayNameRef, - Selector: mg.Spec.ForProvider.VirtualGatewayNameSelector, - To: reference.To{ - List: &VirtualGatewayList{}, - Managed: &VirtualGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualGateway", + + "VirtualGatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualGatewayName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.VirtualGatewayNameRef, + Selector: mg.Spec.ForProvider.VirtualGatewayNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VirtualGatewayName") } @@ -69,16 +94,26 @@ func (mg *GatewayRoute) ResolveReferences(ctx context.Context, c client.Reader) for i5 := 0; i5 < len(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target); i6++ { for i7 := 0; i7 < len(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService); i7++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceNameRef, - Selector: mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceNameSelector, - To: reference.To{ - List: &VirtualServiceList{}, - Managed: &VirtualService{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualService", + + "VirtualServiceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceNameRef, + Selector: mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].Target[i6].VirtualService[i7].VirtualServiceName") } @@ -90,16 +125,26 @@ func (mg *GatewayRoute) ResolveReferences(ctx context.Context, c client.Reader) } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualGatewayName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.VirtualGatewayNameRef, - Selector: mg.Spec.InitProvider.VirtualGatewayNameSelector, - To: reference.To{ - List: &VirtualGatewayList{}, - Managed: &VirtualGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualGateway", + + "VirtualGatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualGatewayName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.VirtualGatewayNameRef, + Selector: mg.Spec.InitProvider.VirtualGatewayNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VirtualGatewayName") } @@ -111,21 +156,33 @@ func (mg *GatewayRoute) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Route. func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MeshName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.MeshNameRef, - Selector: mg.Spec.ForProvider.MeshNameSelector, - To: reference.To{ - List: &MeshList{}, - Managed: &Mesh{}, - }, - }) + "v1beta1", + + "Mesh", + "MeshList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MeshName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.MeshNameRef, + Selector: mg.Spec.ForProvider.MeshNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MeshName") } @@ -136,16 +193,27 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { for i4 := 0; i4 < len(mg.Spec.ForProvider.Spec[i3].HTTPRoute); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeRef, - Selector: mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeSelector, - To: reference.To{ - List: &VirtualNodeList{}, - Managed: &VirtualNode{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualNode", + + "VirtualNodeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeRef, + Selector: mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode") } @@ -160,16 +228,27 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { for i4 := 0; i4 < len(mg.Spec.ForProvider.Spec[i3].TCPRoute); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeRef, - Selector: mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeSelector, - To: reference.To{ - List: &VirtualNodeList{}, - Managed: &VirtualNode{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualNode", + + "VirtualNodeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeRef, + Selector: mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode") } @@ -180,32 +259,51 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualRouterName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.VirtualRouterNameRef, - Selector: mg.Spec.ForProvider.VirtualRouterNameSelector, - To: reference.To{ - List: &VirtualRouterList{}, - Managed: &VirtualRouter{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualRouter", + + "VirtualRouterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualRouterName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.VirtualRouterNameRef, + Selector: mg.Spec.ForProvider.VirtualRouterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VirtualRouterName") } mg.Spec.ForProvider.VirtualRouterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VirtualRouterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MeshName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.MeshNameRef, - Selector: mg.Spec.InitProvider.MeshNameSelector, - To: reference.To{ - List: &MeshList{}, - Managed: &Mesh{}, - }, - }) + "Mesh", + "MeshList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MeshName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.MeshNameRef, + Selector: mg.Spec.InitProvider.MeshNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MeshName") } @@ -216,16 +314,27 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { for i4 := 0; i4 < len(mg.Spec.InitProvider.Spec[i3].HTTPRoute); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeRef, - Selector: mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeSelector, - To: reference.To{ - List: &VirtualNodeList{}, - Managed: &VirtualNode{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualNode", + + "VirtualNodeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeRef, + Selector: mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Spec[i3].HTTPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode") } @@ -240,16 +349,27 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { for i4 := 0; i4 < len(mg.Spec.InitProvider.Spec[i3].TCPRoute); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeRef, - Selector: mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeSelector, - To: reference.To{ - List: &VirtualNodeList{}, - Managed: &VirtualNode{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualNode", + + "VirtualNodeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeRef, + Selector: mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNodeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Spec[i3].TCPRoute[i4].Action[i5].WeightedTarget[i6].VirtualNode") } @@ -260,16 +380,26 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualRouterName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.VirtualRouterNameRef, - Selector: mg.Spec.InitProvider.VirtualRouterNameSelector, - To: reference.To{ - List: &VirtualRouterList{}, - Managed: &VirtualRouter{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualRouter", + + "VirtualRouterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualRouterName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.VirtualRouterNameRef, + Selector: mg.Spec.InitProvider.VirtualRouterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VirtualRouterName") } @@ -281,6 +411,9 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this VirtualGateway. func (mg *VirtualGateway) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -291,16 +424,26 @@ func (mg *VirtualGateway) ResolveReferences(ctx context.Context, c client.Reader for i5 := 0; i5 < len(mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate); i6++ { for i7 := 0; i7 < len(mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm); i7++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArnRef, - Selector: mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArnSelector, - To: reference.To{ - List: &v1beta1.CertificateList{}, - Managed: &v1beta1.Certificate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArnRef, + Selector: mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArn") } @@ -317,16 +460,26 @@ func (mg *VirtualGateway) ResolveReferences(ctx context.Context, c client.Reader for i5 := 0; i5 < len(mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate); i6++ { for i7 := 0; i7 < len(mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm); i7++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArnRef, - Selector: mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArnSelector, - To: reference.To{ - List: &v1beta1.CertificateList{}, - Managed: &v1beta1.Certificate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArnRef, + Selector: mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Spec[i3].Listener[i4].TLS[i5].Certificate[i6].Acm[i7].CertificateArn") } @@ -344,21 +497,33 @@ func (mg *VirtualGateway) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this VirtualNode. func (mg *VirtualNode) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MeshName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.MeshNameRef, - Selector: mg.Spec.ForProvider.MeshNameSelector, - To: reference.To{ - List: &MeshList{}, - Managed: &Mesh{}, - }, - }) + "v1beta1", + + "Mesh", + "MeshList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MeshName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.MeshNameRef, + Selector: mg.Spec.ForProvider.MeshNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MeshName") } @@ -368,16 +533,25 @@ func (mg *VirtualNode) ResolveReferences(ctx context.Context, c client.Reader) e for i3 := 0; i3 < len(mg.Spec.ForProvider.Spec); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Spec[i3].ServiceDiscovery); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceNameRef, - Selector: mg.Spec.ForProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceNameSelector, - To: reference.To{ - List: &v1beta11.HTTPNamespaceList{}, - Managed: &v1beta11.HTTPNamespace{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicediscovery.aws.upbound.io", + + "v1beta1", + "HTTPNamespace", + + "HTTPNamespaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceNameRef, + Selector: mg.Spec.ForProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceName") } @@ -387,16 +561,26 @@ func (mg *VirtualNode) ResolveReferences(ctx context.Context, c client.Reader) e } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MeshName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.MeshNameRef, - Selector: mg.Spec.InitProvider.MeshNameSelector, - To: reference.To{ - List: &MeshList{}, - Managed: &Mesh{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "Mesh", + "MeshList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MeshName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.MeshNameRef, + Selector: mg.Spec.InitProvider.MeshNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MeshName") } @@ -406,16 +590,25 @@ func (mg *VirtualNode) ResolveReferences(ctx context.Context, c client.Reader) e for i3 := 0; i3 < len(mg.Spec.InitProvider.Spec); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Spec[i3].ServiceDiscovery); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceNameRef, - Selector: mg.Spec.InitProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceNameSelector, - To: reference.To{ - List: &v1beta11.HTTPNamespaceList{}, - Managed: &v1beta11.HTTPNamespace{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicediscovery.aws.upbound.io", + + "v1beta1", + "HTTPNamespace", + + "HTTPNamespaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceNameRef, + Selector: mg.Spec.InitProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Spec[i3].ServiceDiscovery[i4].AwsCloudMap[i5].NamespaceName") } @@ -431,37 +624,58 @@ func (mg *VirtualNode) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this VirtualRouter. func (mg *VirtualRouter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "Mesh", + "MeshList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MeshName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.MeshNameRef, - Selector: mg.Spec.ForProvider.MeshNameSelector, - To: reference.To{ - List: &MeshList{}, - Managed: &Mesh{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MeshName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.MeshNameRef, + Selector: mg.Spec.ForProvider.MeshNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MeshName") } mg.Spec.ForProvider.MeshName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.MeshNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "Mesh", + "MeshList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MeshName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.MeshNameRef, - Selector: mg.Spec.InitProvider.MeshNameSelector, - To: reference.To{ - List: &MeshList{}, - Managed: &Mesh{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MeshName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.MeshNameRef, + Selector: mg.Spec.InitProvider.MeshNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MeshName") } @@ -473,21 +687,33 @@ func (mg *VirtualRouter) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this VirtualService. func (mg *VirtualService) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MeshName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.MeshNameRef, - Selector: mg.Spec.ForProvider.MeshNameSelector, - To: reference.To{ - List: &MeshList{}, - Managed: &Mesh{}, - }, - }) + "v1beta1", + + "Mesh", + "MeshList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MeshName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.MeshNameRef, + Selector: mg.Spec.ForProvider.MeshNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MeshName") } @@ -497,16 +723,27 @@ func (mg *VirtualService) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.ForProvider.Spec); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Spec[i3].Provider); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualNode); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeNameRef, - Selector: mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeNameSelector, - To: reference.To{ - List: &VirtualNodeList{}, - Managed: &VirtualNode{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualNode", + + "VirtualNodeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeNameRef, + Selector: mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeName") } @@ -519,16 +756,26 @@ func (mg *VirtualService) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.ForProvider.Spec); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Spec[i3].Provider); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualRouter); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterNameRef, - Selector: mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterNameSelector, - To: reference.To{ - List: &VirtualRouterList{}, - Managed: &VirtualRouter{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualRouter", + + "VirtualRouterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterNameRef, + Selector: mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterName") } @@ -538,16 +785,26 @@ func (mg *VirtualService) ResolveReferences(ctx context.Context, c client.Reader } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MeshName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.MeshNameRef, - Selector: mg.Spec.InitProvider.MeshNameSelector, - To: reference.To{ - List: &MeshList{}, - Managed: &Mesh{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "Mesh", + "MeshList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MeshName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.MeshNameRef, + Selector: mg.Spec.InitProvider.MeshNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MeshName") } @@ -557,16 +814,27 @@ func (mg *VirtualService) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.InitProvider.Spec); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Spec[i3].Provider); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualNode); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeNameRef, - Selector: mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeNameSelector, - To: reference.To{ - List: &VirtualNodeList{}, - Managed: &VirtualNode{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualNode", + + "VirtualNodeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeNameRef, + Selector: mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualNode[i5].VirtualNodeName") } @@ -579,16 +847,26 @@ func (mg *VirtualService) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.InitProvider.Spec); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Spec[i3].Provider); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualRouter); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterNameRef, - Selector: mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterNameSelector, - To: reference.To{ - List: &VirtualRouterList{}, - Managed: &VirtualRouter{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("appmesh.aws.upbound.io", + + "v1beta1", + + "VirtualRouter", + + "VirtualRouterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterNameRef, + Selector: mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Spec[i3].Provider[i4].VirtualRouter[i5].VirtualRouterName") } diff --git a/apis/apprunner/v1beta1/zz_generated.resolvers.go b/apis/apprunner/v1beta1/zz_generated.resolvers.go index a29509b1a9..4bb1cc751a 100644 --- a/apis/apprunner/v1beta1/zz_generated.resolvers.go +++ b/apis/apprunner/v1beta1/zz_generated.resolvers.go @@ -10,12 +10,18 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Service. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Service. func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -23,16 +29,26 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.ForProvider.NetworkConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.NetworkConfiguration[i3].EgressConfiguration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArnRef, - Selector: mg.Spec.ForProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArnSelector, - To: reference.To{ - List: &VPCConnectorList{}, - Managed: &VPCConnector{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apprunner.aws.upbound.io", + + "v1beta1", + + "VPCConnector", + + "VPCConnectorList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArnRef, + Selector: mg.Spec.ForProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArn") } @@ -42,16 +58,27 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } } for i3 := 0; i3 < len(mg.Spec.ForProvider.ObservabilityConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArnRef, - Selector: mg.Spec.ForProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArnSelector, - To: reference.To{ - List: &ObservabilityConfigurationList{}, - Managed: &ObservabilityConfiguration{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apprunner.aws.upbound.io", + + "v1beta1", + + "ObservabilityConfiguration", + + "ObservabilityConfigurationList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArnRef, + Selector: mg.Spec.ForProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArn") } @@ -61,16 +88,27 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.SourceConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.SourceConfiguration[i3].AuthenticationConfiguration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArnRef, - Selector: mg.Spec.ForProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArnSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apprunner.aws.upbound.io", + + "v1beta1", + + "Connection", + + "ConnectionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArnRef, + Selector: mg.Spec.ForProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArn") } @@ -81,16 +119,26 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.NetworkConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.NetworkConfiguration[i3].EgressConfiguration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArnRef, - Selector: mg.Spec.InitProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArnSelector, - To: reference.To{ - List: &VPCConnectorList{}, - Managed: &VPCConnector{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apprunner.aws.upbound.io", + + "v1beta1", + + "VPCConnector", + + "VPCConnectorList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArnRef, + Selector: mg.Spec.InitProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkConfiguration[i3].EgressConfiguration[i4].VPCConnectorArn") } @@ -100,16 +148,27 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } } for i3 := 0; i3 < len(mg.Spec.InitProvider.ObservabilityConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArnRef, - Selector: mg.Spec.InitProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArnSelector, - To: reference.To{ - List: &ObservabilityConfigurationList{}, - Managed: &ObservabilityConfiguration{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apprunner.aws.upbound.io", + + "v1beta1", + + "ObservabilityConfiguration", + + "ObservabilityConfigurationList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArnRef, + Selector: mg.Spec.InitProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ObservabilityConfiguration[i3].ObservabilityConfigurationArn") } @@ -119,16 +178,27 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.SourceConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.SourceConfiguration[i3].AuthenticationConfiguration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArnRef, - Selector: mg.Spec.InitProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArnSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("apprunner.aws.upbound.io", + + "v1beta1", + + "Connection", + + "ConnectionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArnRef, + Selector: mg.Spec.InitProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceConfiguration[i3].AuthenticationConfiguration[i4].ConnectionArn") } @@ -143,69 +213,108 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this VPCConnector. func (mg *VPCConnector) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupRefs, - Selector: mg.Spec.ForProvider.SecurityGroupSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupRefs, + Selector: mg.Spec.ForProvider.SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroups") } mg.Spec.ForProvider.SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Subnets), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetRefs, - Selector: mg.Spec.ForProvider.SubnetSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Subnets), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetRefs, + Selector: mg.Spec.ForProvider.SubnetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Subnets") } mg.Spec.ForProvider.Subnets = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupRefs, - Selector: mg.Spec.InitProvider.SecurityGroupSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupRefs, + Selector: mg.Spec.InitProvider.SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroups") } mg.Spec.InitProvider.SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Subnets), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetRefs, - Selector: mg.Spec.InitProvider.SubnetSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Subnets), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetRefs, + Selector: mg.Spec.InitProvider.SubnetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Subnets") } diff --git a/apis/appstream/v1beta1/zz_generated.resolvers.go b/apis/appstream/v1beta1/zz_generated.resolvers.go index 6e7a04dfeb..858de7b32b 100644 --- a/apis/appstream/v1beta1/zz_generated.resolvers.go +++ b/apis/appstream/v1beta1/zz_generated.resolvers.go @@ -10,30 +10,45 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Fleet. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Fleet. func (mg *Fleet) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMRoleArnRef, - Selector: mg.Spec.ForProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMRoleArnRef, + Selector: mg.Spec.ForProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoleArn") } @@ -41,16 +56,26 @@ func (mg *Fleet) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.IAMRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SubnetIds") } @@ -58,16 +83,27 @@ func (mg *Fleet) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs = mrsp.ResolvedReferences } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMRoleArnRef, - Selector: mg.Spec.InitProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMRoleArnRef, + Selector: mg.Spec.InitProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoleArn") } @@ -75,16 +111,26 @@ func (mg *Fleet) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.InitProvider.IAMRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SubnetIds") } @@ -98,37 +144,58 @@ func (mg *Fleet) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this FleetStackAssociation. func (mg *FleetStackAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appstream.aws.upbound.io", + + "v1beta1", + + "Fleet", + "FleetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FleetName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.FleetNameRef, - Selector: mg.Spec.ForProvider.FleetNameSelector, - To: reference.To{ - List: &FleetList{}, - Managed: &Fleet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FleetName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.FleetNameRef, + Selector: mg.Spec.ForProvider.FleetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FleetName") } mg.Spec.ForProvider.FleetName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FleetNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appstream.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.StackNameRef, - Selector: mg.Spec.ForProvider.StackNameSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.StackNameRef, + Selector: mg.Spec.ForProvider.StackNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackName") } @@ -140,22 +207,35 @@ func (mg *FleetStackAssociation) ResolveReferences(ctx context.Context, c client // ResolveReferences of this ImageBuilder. func (mg *ImageBuilder) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMRoleArnRef, - Selector: mg.Spec.ForProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMRoleArnRef, + Selector: mg.Spec.ForProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoleArn") } @@ -163,16 +243,26 @@ func (mg *ImageBuilder) ResolveReferences(ctx context.Context, c client.Reader) mg.Spec.ForProvider.IAMRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SubnetIds") } @@ -180,16 +270,27 @@ func (mg *ImageBuilder) ResolveReferences(ctx context.Context, c client.Reader) mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs = mrsp.ResolvedReferences } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMRoleArnRef, - Selector: mg.Spec.InitProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMRoleArnRef, + Selector: mg.Spec.InitProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoleArn") } @@ -197,16 +298,26 @@ func (mg *ImageBuilder) ResolveReferences(ctx context.Context, c client.Reader) mg.Spec.InitProvider.IAMRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SubnetIds") } @@ -220,53 +331,83 @@ func (mg *ImageBuilder) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this UserStackAssociation. func (mg *UserStackAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appstream.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthenticationType), - Extract: resource.ExtractParamPath("authentication_type", false), - Reference: mg.Spec.ForProvider.AuthenticationTypeRef, - Selector: mg.Spec.ForProvider.AuthenticationTypeSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + "v1beta1", + + "User", + "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AuthenticationType), + Extract: resource.ExtractParamPath("authentication_type", false), + Reference: mg.Spec.ForProvider.AuthenticationTypeRef, + Selector: mg.Spec.ForProvider.AuthenticationTypeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AuthenticationType") } mg.Spec.ForProvider.AuthenticationType = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AuthenticationTypeRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appstream.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.StackNameRef, - Selector: mg.Spec.ForProvider.StackNameSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.StackNameRef, + Selector: mg.Spec.ForProvider.StackNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackName") } mg.Spec.ForProvider.StackName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appstream.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserNameRef, - Selector: mg.Spec.ForProvider.UserNameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + "User", + "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserNameRef, + Selector: mg.Spec.ForProvider.UserNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserName") } diff --git a/apis/appsync/v1beta1/zz_generated.resolvers.go b/apis/appsync/v1beta1/zz_generated.resolvers.go index 41f379d98d..3ac568da83 100644 --- a/apis/appsync/v1beta1/zz_generated.resolvers.go +++ b/apis/appsync/v1beta1/zz_generated.resolvers.go @@ -10,46 +10,70 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/dynamodb/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" + common "github.com/upbound/provider-aws/config/common" + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this APICache. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this APICache. func (mg *APICache) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", + + "v1beta1", + + "GraphQLAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &GraphQLAPIList{}, - Managed: &GraphQLAPI{}, - }, - }) + "GraphQLAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &GraphQLAPIList{}, - Managed: &GraphQLAPI{}, - }, - }) + "GraphQLAPI", + + "GraphQLAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } @@ -61,21 +85,34 @@ func (mg *APICache) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this APIKey. func (mg *APIKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", + + "v1beta1", + + "GraphQLAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &GraphQLAPIList{}, - Managed: &GraphQLAPI{}, - }, - }) + "GraphQLAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } @@ -87,21 +124,34 @@ func (mg *APIKey) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Datasource. func (mg *Datasource) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", + + "v1beta1", + + "GraphQLAPI", + + "GraphQLAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &GraphQLAPIList{}, - Managed: &GraphQLAPI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } @@ -109,16 +159,26 @@ func (mg *Datasource) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.DynamodbConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DynamodbConfig[i3].TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DynamodbConfig[i3].TableNameRef, - Selector: mg.Spec.ForProvider.DynamodbConfig[i3].TableNameSelector, - To: reference.To{ - List: &v1beta1.TableList{}, - Managed: &v1beta1.Table{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", + + "v1beta1", + + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DynamodbConfig[i3].TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DynamodbConfig[i3].TableNameRef, + Selector: mg.Spec.ForProvider.DynamodbConfig[i3].TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DynamodbConfig[i3].TableName") } @@ -126,16 +186,27 @@ func (mg *Datasource) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.ForProvider.DynamodbConfig[i3].TableNameRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceRoleArnRef, - Selector: mg.Spec.ForProvider.ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceRoleArnRef, + Selector: mg.Spec.ForProvider.ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceRoleArn") } @@ -143,16 +214,26 @@ func (mg *Datasource) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.ForProvider.ServiceRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.DynamodbConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DynamodbConfig[i3].TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DynamodbConfig[i3].TableNameRef, - Selector: mg.Spec.InitProvider.DynamodbConfig[i3].TableNameSelector, - To: reference.To{ - List: &v1beta1.TableList{}, - Managed: &v1beta1.Table{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", + + "v1beta1", + + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DynamodbConfig[i3].TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DynamodbConfig[i3].TableNameRef, + Selector: mg.Spec.InitProvider.DynamodbConfig[i3].TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DynamodbConfig[i3].TableName") } @@ -160,16 +241,27 @@ func (mg *Datasource) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.InitProvider.DynamodbConfig[i3].TableNameRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceRoleArnRef, - Selector: mg.Spec.InitProvider.ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceRoleArnRef, + Selector: mg.Spec.InitProvider.ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceRoleArn") } @@ -181,69 +273,112 @@ func (mg *Datasource) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Function. func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", + + "v1beta1", + + "GraphQLAPI", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &GraphQLAPIList{}, - Managed: &GraphQLAPI{}, - }, - }) + "GraphQLAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", + + "v1beta1", + + "Datasource", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataSource), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DataSourceRef, - Selector: mg.Spec.ForProvider.DataSourceSelector, - To: reference.To{ - List: &DatasourceList{}, - Managed: &Datasource{}, - }, - }) + "DatasourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataSource), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DataSourceRef, + Selector: mg.Spec.ForProvider.DataSourceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DataSource") } mg.Spec.ForProvider.DataSource = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DataSourceRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.APIIDRef, - Selector: mg.Spec.InitProvider.APIIDSelector, - To: reference.To{ - List: &GraphQLAPIList{}, - Managed: &GraphQLAPI{}, - }, - }) + "GraphQLAPI", + + "GraphQLAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.APIIDRef, + Selector: mg.Spec.InitProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.APIID") } mg.Spec.InitProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataSource), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DataSourceRef, - Selector: mg.Spec.InitProvider.DataSourceSelector, - To: reference.To{ - List: &DatasourceList{}, - Managed: &Datasource{}, - }, - }) + "Datasource", + + "DatasourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataSource), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DataSourceRef, + Selector: mg.Spec.InitProvider.DataSourceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DataSource") } @@ -255,22 +390,36 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this GraphQLAPI. func (mg *GraphQLAPI) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.LogConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogConfig[i3].CloudwatchLogsRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.LogConfig[i3].CloudwatchLogsRoleArnRef, - Selector: mg.Spec.ForProvider.LogConfig[i3].CloudwatchLogsRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogConfig[i3].CloudwatchLogsRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.LogConfig[i3].CloudwatchLogsRoleArnRef, + Selector: mg.Spec.ForProvider.LogConfig[i3].CloudwatchLogsRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LogConfig[i3].CloudwatchLogsRoleArn") } @@ -279,16 +428,27 @@ func (mg *GraphQLAPI) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.ForProvider.UserPoolConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolConfig[i3].UserPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.UserPoolConfig[i3].UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolConfig[i3].UserPoolIDSelector, - To: reference.To{ - List: &v1beta12.UserPoolList{}, - Managed: &v1beta12.UserPool{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolConfig[i3].UserPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.UserPoolConfig[i3].UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolConfig[i3].UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolConfig[i3].UserPoolID") } @@ -297,16 +457,27 @@ func (mg *GraphQLAPI) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.InitProvider.LogConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogConfig[i3].CloudwatchLogsRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.LogConfig[i3].CloudwatchLogsRoleArnRef, - Selector: mg.Spec.InitProvider.LogConfig[i3].CloudwatchLogsRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogConfig[i3].CloudwatchLogsRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.LogConfig[i3].CloudwatchLogsRoleArnRef, + Selector: mg.Spec.InitProvider.LogConfig[i3].CloudwatchLogsRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LogConfig[i3].CloudwatchLogsRoleArn") } @@ -315,16 +486,27 @@ func (mg *GraphQLAPI) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.InitProvider.UserPoolConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolConfig[i3].UserPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.UserPoolConfig[i3].UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolConfig[i3].UserPoolIDSelector, - To: reference.To{ - List: &v1beta12.UserPoolList{}, - Managed: &v1beta12.UserPool{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolConfig[i3].UserPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.UserPoolConfig[i3].UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolConfig[i3].UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolConfig[i3].UserPoolID") } @@ -338,53 +520,86 @@ func (mg *GraphQLAPI) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Resolver. func (mg *Resolver) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.APIIDRef, - Selector: mg.Spec.ForProvider.APIIDSelector, - To: reference.To{ - List: &GraphQLAPIList{}, - Managed: &GraphQLAPI{}, - }, - }) + "v1beta1", + + "GraphQLAPI", + + "GraphQLAPIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.APIID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.APIIDRef, + Selector: mg.Spec.ForProvider.APIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.APIID") } mg.Spec.ForProvider.APIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataSource), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DataSourceRef, - Selector: mg.Spec.ForProvider.DataSourceSelector, - To: reference.To{ - List: &DatasourceList{}, - Managed: &Datasource{}, - }, - }) + "v1beta1", + + "Datasource", + + "DatasourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataSource), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DataSourceRef, + Selector: mg.Spec.ForProvider.DataSourceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DataSource") } mg.Spec.ForProvider.DataSource = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DataSourceRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("appsync.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataSource), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DataSourceRef, - Selector: mg.Spec.InitProvider.DataSourceSelector, - To: reference.To{ - List: &DatasourceList{}, - Managed: &Datasource{}, - }, - }) + "v1beta1", + + "Datasource", + + "DatasourceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataSource), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DataSourceRef, + Selector: mg.Spec.InitProvider.DataSourceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DataSource") } diff --git a/apis/athena/v1beta1/zz_generated.resolvers.go b/apis/athena/v1beta1/zz_generated.resolvers.go index 36f20f13bb..ecebd63d5f 100644 --- a/apis/athena/v1beta1/zz_generated.resolvers.go +++ b/apis/athena/v1beta1/zz_generated.resolvers.go @@ -10,45 +10,68 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Database. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Database. func (mg *Database) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -60,69 +83,108 @@ func (mg *Database) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this NamedQuery. func (mg *NamedQuery) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("athena.aws.upbound.io", + + "v1beta1", + + "Database", + "DatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Database), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DatabaseRef, - Selector: mg.Spec.ForProvider.DatabaseSelector, - To: reference.To{ - List: &DatabaseList{}, - Managed: &Database{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Database), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DatabaseRef, + Selector: mg.Spec.ForProvider.DatabaseSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Database") } mg.Spec.ForProvider.Database = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DatabaseRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("athena.aws.upbound.io", + + "v1beta1", + + "Workgroup", + "WorkgroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Workgroup), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WorkgroupRef, - Selector: mg.Spec.ForProvider.WorkgroupSelector, - To: reference.To{ - List: &WorkgroupList{}, - Managed: &Workgroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Workgroup), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WorkgroupRef, + Selector: mg.Spec.ForProvider.WorkgroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Workgroup") } mg.Spec.ForProvider.Workgroup = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.WorkgroupRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("athena.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Database), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DatabaseRef, - Selector: mg.Spec.InitProvider.DatabaseSelector, - To: reference.To{ - List: &DatabaseList{}, - Managed: &Database{}, - }, - }) + "Database", + "DatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Database), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DatabaseRef, + Selector: mg.Spec.InitProvider.DatabaseSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Database") } mg.Spec.InitProvider.Database = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DatabaseRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("athena.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Workgroup), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.WorkgroupRef, - Selector: mg.Spec.InitProvider.WorkgroupSelector, - To: reference.To{ - List: &WorkgroupList{}, - Managed: &Workgroup{}, - }, - }) + "v1beta1", + + "Workgroup", + "WorkgroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Workgroup), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.WorkgroupRef, + Selector: mg.Spec.InitProvider.WorkgroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Workgroup") } @@ -134,6 +196,9 @@ func (mg *NamedQuery) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Workgroup. func (mg *Workgroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -142,16 +207,25 @@ func (mg *Workgroup) ResolveReferences(ctx context.Context, c client.Reader) err for i3 := 0; i3 < len(mg.Spec.ForProvider.Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Configuration[i3].ResultConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArnRef, - Selector: mg.Spec.ForProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArnRef, + Selector: mg.Spec.ForProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArn") } @@ -164,16 +238,25 @@ func (mg *Workgroup) ResolveReferences(ctx context.Context, c client.Reader) err for i3 := 0; i3 < len(mg.Spec.InitProvider.Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Configuration[i3].ResultConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArnRef, - Selector: mg.Spec.InitProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArnRef, + Selector: mg.Spec.InitProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Configuration[i3].ResultConfiguration[i4].EncryptionConfiguration[i5].KMSKeyArn") } diff --git a/apis/autoscaling/v1beta1/zz_generated.resolvers.go b/apis/autoscaling/v1beta1/zz_generated.resolvers.go index 9c93dcb815..18270f3478 100644 --- a/apis/autoscaling/v1beta1/zz_generated.resolvers.go +++ b/apis/autoscaling/v1beta1/zz_generated.resolvers.go @@ -10,112 +10,168 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Attachment. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Attachment. func (mg *Attachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", + + "AutoscalingGroup", + + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, - Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, - To: reference.To{ - List: &AutoscalingGroupList{}, - Managed: &AutoscalingGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, + Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AutoscalingGroupName") } mg.Spec.ForProvider.AutoscalingGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AutoscalingGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ELB), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ELBRef, - Selector: mg.Spec.ForProvider.ELBSelector, - To: reference.To{ - List: &v1beta1.ELBList{}, - Managed: &v1beta1.ELB{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ELB), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ELBRef, + Selector: mg.Spec.ForProvider.ELBSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ELB") } mg.Spec.ForProvider.ELB = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ELBRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LBTargetGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.LBTargetGroupArnRef, - Selector: mg.Spec.ForProvider.LBTargetGroupArnSelector, - To: reference.To{ - List: &v1beta11.LBTargetGroupList{}, - Managed: &v1beta11.LBTargetGroup{}, - }, - }) + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LBTargetGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.LBTargetGroupArnRef, + Selector: mg.Spec.ForProvider.LBTargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LBTargetGroupArn") } mg.Spec.ForProvider.LBTargetGroupArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LBTargetGroupArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", + + "AutoscalingGroup", + + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AutoscalingGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.AutoscalingGroupNameRef, - Selector: mg.Spec.InitProvider.AutoscalingGroupNameSelector, - To: reference.To{ - List: &AutoscalingGroupList{}, - Managed: &AutoscalingGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AutoscalingGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.AutoscalingGroupNameRef, + Selector: mg.Spec.InitProvider.AutoscalingGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AutoscalingGroupName") } mg.Spec.InitProvider.AutoscalingGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AutoscalingGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ELB), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ELBRef, - Selector: mg.Spec.InitProvider.ELBSelector, - To: reference.To{ - List: &v1beta1.ELBList{}, - Managed: &v1beta1.ELB{}, - }, - }) + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ELB), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ELBRef, + Selector: mg.Spec.InitProvider.ELBSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ELB") } mg.Spec.InitProvider.ELB = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ELBRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LBTargetGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.LBTargetGroupArnRef, - Selector: mg.Spec.InitProvider.LBTargetGroupArnSelector, - To: reference.To{ - List: &v1beta11.LBTargetGroupList{}, - Managed: &v1beta11.LBTargetGroup{}, - }, - }) + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LBTargetGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.LBTargetGroupArnRef, + Selector: mg.Spec.InitProvider.LBTargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LBTargetGroupArn") } @@ -127,22 +183,36 @@ func (mg *Attachment) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this AutoscalingGroup. func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchConfiguration), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LaunchConfigurationRef, - Selector: mg.Spec.ForProvider.LaunchConfigurationSelector, - To: reference.To{ - List: &LaunchConfigurationList{}, - Managed: &LaunchConfiguration{}, - }, - }) + "LaunchConfiguration", + + "LaunchConfigurationList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchConfiguration), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LaunchConfigurationRef, + Selector: mg.Spec.ForProvider.LaunchConfigurationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LaunchConfiguration") } @@ -150,16 +220,27 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read mg.Spec.ForProvider.LaunchConfigurationRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.LaunchTemplate); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchTemplate[i3].ID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.LaunchTemplate[i3].IDRef, - Selector: mg.Spec.ForProvider.LaunchTemplate[i3].IDSelector, - To: reference.To{ - List: &v1beta12.LaunchTemplateList{}, - Managed: &v1beta12.LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchTemplate[i3].ID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.LaunchTemplate[i3].IDRef, + Selector: mg.Spec.ForProvider.LaunchTemplate[i3].IDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LaunchTemplate[i3].ID") } @@ -170,16 +251,27 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read for i3 := 0; i3 < len(mg.Spec.ForProvider.MixedInstancesPolicy); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateIDRef, - Selector: mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateIDSelector, - To: reference.To{ - List: &v1beta12.LaunchTemplateList{}, - Managed: &v1beta12.LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateIDRef, + Selector: mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateID") } @@ -193,16 +285,27 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read for i4 := 0; i4 < len(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateIDRef, - Selector: mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateIDSelector, - To: reference.To{ - List: &v1beta12.LaunchTemplateList{}, - Managed: &v1beta12.LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateIDRef, + Selector: mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateID") } @@ -213,64 +316,105 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PlacementGroup), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PlacementGroupRef, - Selector: mg.Spec.ForProvider.PlacementGroupSelector, - To: reference.To{ - List: &v1beta12.PlacementGroupList{}, - Managed: &v1beta12.PlacementGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "PlacementGroup", + + "PlacementGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PlacementGroup), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PlacementGroupRef, + Selector: mg.Spec.ForProvider.PlacementGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PlacementGroup") } mg.Spec.ForProvider.PlacementGroup = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PlacementGroupRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceLinkedRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceLinkedRoleArnRef, - Selector: mg.Spec.ForProvider.ServiceLinkedRoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceLinkedRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceLinkedRoleArnRef, + Selector: mg.Spec.ForProvider.ServiceLinkedRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceLinkedRoleArn") } mg.Spec.ForProvider.ServiceLinkedRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServiceLinkedRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCZoneIdentifier), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCZoneIdentifierRefs, - Selector: mg.Spec.ForProvider.VPCZoneIdentifierSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCZoneIdentifier), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCZoneIdentifierRefs, + Selector: mg.Spec.ForProvider.VPCZoneIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCZoneIdentifier") } mg.Spec.ForProvider.VPCZoneIdentifier = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCZoneIdentifierRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", + + "LaunchConfiguration", + + "LaunchConfigurationList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchConfiguration), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LaunchConfigurationRef, - Selector: mg.Spec.InitProvider.LaunchConfigurationSelector, - To: reference.To{ - List: &LaunchConfigurationList{}, - Managed: &LaunchConfiguration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchConfiguration), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LaunchConfigurationRef, + Selector: mg.Spec.InitProvider.LaunchConfigurationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LaunchConfiguration") } @@ -278,16 +422,27 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read mg.Spec.InitProvider.LaunchConfigurationRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.LaunchTemplate); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchTemplate[i3].ID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.LaunchTemplate[i3].IDRef, - Selector: mg.Spec.InitProvider.LaunchTemplate[i3].IDSelector, - To: reference.To{ - List: &v1beta12.LaunchTemplateList{}, - Managed: &v1beta12.LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchTemplate[i3].ID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.LaunchTemplate[i3].IDRef, + Selector: mg.Spec.InitProvider.LaunchTemplate[i3].IDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LaunchTemplate[i3].ID") } @@ -298,16 +453,27 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read for i3 := 0; i3 < len(mg.Spec.InitProvider.MixedInstancesPolicy); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateIDRef, - Selector: mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateIDSelector, - To: reference.To{ - List: &v1beta12.LaunchTemplateList{}, - Managed: &v1beta12.LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateIDRef, + Selector: mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].LaunchTemplateSpecification[i5].LaunchTemplateID") } @@ -321,16 +487,27 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read for i4 := 0; i4 < len(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateIDRef, - Selector: mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateIDSelector, - To: reference.To{ - List: &v1beta12.LaunchTemplateList{}, - Managed: &v1beta12.LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateIDRef, + Selector: mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MixedInstancesPolicy[i3].LaunchTemplate[i4].Override[i5].LaunchTemplateSpecification[i6].LaunchTemplateID") } @@ -341,48 +518,78 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PlacementGroup), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PlacementGroupRef, - Selector: mg.Spec.InitProvider.PlacementGroupSelector, - To: reference.To{ - List: &v1beta12.PlacementGroupList{}, - Managed: &v1beta12.PlacementGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "PlacementGroup", + + "PlacementGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PlacementGroup), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PlacementGroupRef, + Selector: mg.Spec.InitProvider.PlacementGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PlacementGroup") } mg.Spec.InitProvider.PlacementGroup = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PlacementGroupRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceLinkedRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceLinkedRoleArnRef, - Selector: mg.Spec.InitProvider.ServiceLinkedRoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceLinkedRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceLinkedRoleArnRef, + Selector: mg.Spec.InitProvider.ServiceLinkedRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceLinkedRoleArn") } mg.Spec.InitProvider.ServiceLinkedRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ServiceLinkedRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCZoneIdentifier), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCZoneIdentifierRefs, - Selector: mg.Spec.InitProvider.VPCZoneIdentifierSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCZoneIdentifier), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCZoneIdentifierRefs, + Selector: mg.Spec.InitProvider.VPCZoneIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCZoneIdentifier") } @@ -394,37 +601,58 @@ func (mg *AutoscalingGroup) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this GroupTag. func (mg *GroupTag) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, - Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, - To: reference.To{ - List: &AutoscalingGroupList{}, - Managed: &AutoscalingGroup{}, - }, - }) + "AutoscalingGroup", + + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, + Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AutoscalingGroupName") } mg.Spec.ForProvider.AutoscalingGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AutoscalingGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AutoscalingGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.AutoscalingGroupNameRef, - Selector: mg.Spec.InitProvider.AutoscalingGroupNameSelector, - To: reference.To{ - List: &AutoscalingGroupList{}, - Managed: &AutoscalingGroup{}, - }, - }) + "v1beta1", + + "AutoscalingGroup", + + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AutoscalingGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.AutoscalingGroupNameRef, + Selector: mg.Spec.InitProvider.AutoscalingGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AutoscalingGroupName") } @@ -436,53 +664,85 @@ func (mg *GroupTag) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this LifecycleHook. func (mg *LifecycleHook) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", + + "AutoscalingGroup", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, - Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, - To: reference.To{ - List: &AutoscalingGroupList{}, - Managed: &AutoscalingGroup{}, - }, - }) + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, + Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AutoscalingGroupName") } mg.Spec.ForProvider.AutoscalingGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AutoscalingGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -494,37 +754,58 @@ func (mg *LifecycleHook) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Notification. func (mg *Notification) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TopicArnRef, - Selector: mg.Spec.ForProvider.TopicArnSelector, - To: reference.To{ - List: &v1beta14.TopicList{}, - Managed: &v1beta14.Topic{}, - }, - }) + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TopicArnRef, + Selector: mg.Spec.ForProvider.TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TopicArn") } mg.Spec.ForProvider.TopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TopicArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TopicArnRef, - Selector: mg.Spec.InitProvider.TopicArnSelector, - To: reference.To{ - List: &v1beta14.TopicList{}, - Managed: &v1beta14.Topic{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TopicArnRef, + Selector: mg.Spec.InitProvider.TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TopicArn") } @@ -536,21 +817,33 @@ func (mg *Notification) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Policy. func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, - Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, - To: reference.To{ - List: &AutoscalingGroupList{}, - Managed: &AutoscalingGroup{}, - }, - }) + "v1beta1", + + "AutoscalingGroup", + + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, + Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AutoscalingGroupName") } @@ -562,21 +855,33 @@ func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Schedule. func (mg *Schedule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, - Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, - To: reference.To{ - List: &AutoscalingGroupList{}, - Managed: &AutoscalingGroup{}, - }, - }) + "AutoscalingGroup", + + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoscalingGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AutoscalingGroupNameRef, + Selector: mg.Spec.ForProvider.AutoscalingGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AutoscalingGroupName") } diff --git a/apis/backup/v1beta1/zz_generated.resolvers.go b/apis/backup/v1beta1/zz_generated.resolvers.go index 8e83d10828..37fa11ed63 100644 --- a/apis/backup/v1beta1/zz_generated.resolvers.go +++ b/apis/backup/v1beta1/zz_generated.resolvers.go @@ -9,31 +9,45 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Plan. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Plan. func (mg *Plan) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Rule); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule[i3].TargetVaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.Rule[i3].TargetVaultNameRef, - Selector: mg.Spec.ForProvider.Rule[i3].TargetVaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", + + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule[i3].TargetVaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.Rule[i3].TargetVaultNameRef, + Selector: mg.Spec.ForProvider.Rule[i3].TargetVaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Rule[i3].TargetVaultName") } @@ -42,16 +56,26 @@ func (mg *Plan) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.InitProvider.Rule); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule[i3].TargetVaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.Rule[i3].TargetVaultNameRef, - Selector: mg.Spec.InitProvider.Rule[i3].TargetVaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", + + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule[i3].TargetVaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.Rule[i3].TargetVaultNameRef, + Selector: mg.Spec.InitProvider.Rule[i3].TargetVaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Rule[i3].TargetVaultName") } @@ -65,69 +89,110 @@ func (mg *Plan) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this Selection. func (mg *Selection) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMRoleArnRef, - Selector: mg.Spec.ForProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMRoleArnRef, + Selector: mg.Spec.ForProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoleArn") } mg.Spec.ForProvider.IAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", + + "Plan", + "PlanList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PlanID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PlanIDRef, - Selector: mg.Spec.ForProvider.PlanIDSelector, - To: reference.To{ - List: &PlanList{}, - Managed: &Plan{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PlanID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PlanIDRef, + Selector: mg.Spec.ForProvider.PlanIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PlanID") } mg.Spec.ForProvider.PlanID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PlanIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMRoleArnRef, - Selector: mg.Spec.InitProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMRoleArnRef, + Selector: mg.Spec.InitProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoleArn") } mg.Spec.InitProvider.IAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", + + "Plan", + "PlanList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PlanID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PlanIDRef, - Selector: mg.Spec.InitProvider.PlanIDSelector, - To: reference.To{ - List: &PlanList{}, - Managed: &Plan{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PlanID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PlanIDRef, + Selector: mg.Spec.InitProvider.PlanIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PlanID") } @@ -139,37 +204,56 @@ func (mg *Selection) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this Vault. func (mg *Vault) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } @@ -181,37 +265,58 @@ func (mg *Vault) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this VaultLockConfiguration. func (mg *VaultLockConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", + + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BackupVaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.BackupVaultNameRef, - Selector: mg.Spec.ForProvider.BackupVaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BackupVaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.BackupVaultNameRef, + Selector: mg.Spec.ForProvider.BackupVaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BackupVaultName") } mg.Spec.ForProvider.BackupVaultName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BackupVaultNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", + + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BackupVaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.BackupVaultNameRef, - Selector: mg.Spec.InitProvider.BackupVaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BackupVaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.BackupVaultNameRef, + Selector: mg.Spec.InitProvider.BackupVaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BackupVaultName") } @@ -223,69 +328,108 @@ func (mg *VaultLockConfiguration) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this VaultNotifications. func (mg *VaultNotifications) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BackupVaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.BackupVaultNameRef, - Selector: mg.Spec.ForProvider.BackupVaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BackupVaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.BackupVaultNameRef, + Selector: mg.Spec.ForProvider.BackupVaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BackupVaultName") } mg.Spec.ForProvider.BackupVaultName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BackupVaultNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.SnsTopicArnRef, - Selector: mg.Spec.ForProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.SnsTopicArnRef, + Selector: mg.Spec.ForProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnsTopicArn") } mg.Spec.ForProvider.SnsTopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnsTopicArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BackupVaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.BackupVaultNameRef, - Selector: mg.Spec.InitProvider.BackupVaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BackupVaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.BackupVaultNameRef, + Selector: mg.Spec.InitProvider.BackupVaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BackupVaultName") } mg.Spec.InitProvider.BackupVaultName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BackupVaultNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.SnsTopicArnRef, - Selector: mg.Spec.InitProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.SnsTopicArnRef, + Selector: mg.Spec.InitProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnsTopicArn") } @@ -297,37 +441,58 @@ func (mg *VaultNotifications) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this VaultPolicy. func (mg *VaultPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BackupVaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.BackupVaultNameRef, - Selector: mg.Spec.ForProvider.BackupVaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BackupVaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.BackupVaultNameRef, + Selector: mg.Spec.ForProvider.BackupVaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BackupVaultName") } mg.Spec.ForProvider.BackupVaultName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BackupVaultNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("backup.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BackupVaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.BackupVaultNameRef, - Selector: mg.Spec.InitProvider.BackupVaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BackupVaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.BackupVaultNameRef, + Selector: mg.Spec.InitProvider.BackupVaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BackupVaultName") } diff --git a/apis/budgets/v1beta1/zz_generated.resolvers.go b/apis/budgets/v1beta1/zz_generated.resolvers.go index a09ac7a6ce..daaa12cc70 100644 --- a/apis/budgets/v1beta1/zz_generated.resolvers.go +++ b/apis/budgets/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,43 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this BudgetAction. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this BudgetAction. func (mg *BudgetAction) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("budgets.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BudgetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.BudgetNameRef, - Selector: mg.Spec.ForProvider.BudgetNameSelector, - To: reference.To{ - List: &BudgetList{}, - Managed: &Budget{}, - }, - }) + "Budget", + "BudgetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BudgetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.BudgetNameRef, + Selector: mg.Spec.ForProvider.BudgetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BudgetName") } @@ -40,16 +55,26 @@ func (mg *BudgetAction) ResolveReferences(ctx context.Context, c client.Reader) for i3 := 0; i3 < len(mg.Spec.ForProvider.Definition); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Definition[i3].IAMActionDefinition); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Definition[i3].IAMActionDefinition[i4].PolicyArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Definition[i3].IAMActionDefinition[i4].PolicyArnRef, - Selector: mg.Spec.ForProvider.Definition[i3].IAMActionDefinition[i4].PolicyArnSelector, - To: reference.To{ - List: &v1beta1.PolicyList{}, - Managed: &v1beta1.Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Definition[i3].IAMActionDefinition[i4].PolicyArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Definition[i3].IAMActionDefinition[i4].PolicyArnRef, + Selector: mg.Spec.ForProvider.Definition[i3].IAMActionDefinition[i4].PolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Definition[i3].IAMActionDefinition[i4].PolicyArn") } @@ -58,32 +83,52 @@ func (mg *BudgetAction) ResolveReferences(ctx context.Context, c client.Reader) } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ExecutionRoleArnRef, - Selector: mg.Spec.ForProvider.ExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ExecutionRoleArnRef, + Selector: mg.Spec.ForProvider.ExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExecutionRoleArn") } mg.Spec.ForProvider.ExecutionRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ExecutionRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("budgets.aws.upbound.io", + + "v1beta1", + + "Budget", + "BudgetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BudgetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.BudgetNameRef, - Selector: mg.Spec.InitProvider.BudgetNameSelector, - To: reference.To{ - List: &BudgetList{}, - Managed: &Budget{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BudgetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.BudgetNameRef, + Selector: mg.Spec.InitProvider.BudgetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BudgetName") } @@ -92,16 +137,26 @@ func (mg *BudgetAction) ResolveReferences(ctx context.Context, c client.Reader) for i3 := 0; i3 < len(mg.Spec.InitProvider.Definition); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Definition[i3].IAMActionDefinition); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Definition[i3].IAMActionDefinition[i4].PolicyArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Definition[i3].IAMActionDefinition[i4].PolicyArnRef, - Selector: mg.Spec.InitProvider.Definition[i3].IAMActionDefinition[i4].PolicyArnSelector, - To: reference.To{ - List: &v1beta1.PolicyList{}, - Managed: &v1beta1.Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Definition[i3].IAMActionDefinition[i4].PolicyArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Definition[i3].IAMActionDefinition[i4].PolicyArnRef, + Selector: mg.Spec.InitProvider.Definition[i3].IAMActionDefinition[i4].PolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Definition[i3].IAMActionDefinition[i4].PolicyArn") } @@ -110,16 +165,27 @@ func (mg *BudgetAction) ResolveReferences(ctx context.Context, c client.Reader) } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ExecutionRoleArnRef, - Selector: mg.Spec.InitProvider.ExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ExecutionRoleArnRef, + Selector: mg.Spec.InitProvider.ExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExecutionRoleArn") } diff --git a/apis/chime/v1beta1/zz_generated.resolvers.go b/apis/chime/v1beta1/zz_generated.resolvers.go index af7d4fae58..16817b149e 100644 --- a/apis/chime/v1beta1/zz_generated.resolvers.go +++ b/apis/chime/v1beta1/zz_generated.resolvers.go @@ -8,29 +8,46 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this VoiceConnectorGroup. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this VoiceConnectorGroup. func (mg *VoiceConnectorGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Connector); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Connector[i3].VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Connector[i3].VoiceConnectorIDRef, - Selector: mg.Spec.ForProvider.Connector[i3].VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", + + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Connector[i3].VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Connector[i3].VoiceConnectorIDRef, + Selector: mg.Spec.ForProvider.Connector[i3].VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Connector[i3].VoiceConnectorID") } @@ -39,16 +56,27 @@ func (mg *VoiceConnectorGroup) ResolveReferences(ctx context.Context, c client.R } for i3 := 0; i3 < len(mg.Spec.InitProvider.Connector); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Connector[i3].VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Connector[i3].VoiceConnectorIDRef, - Selector: mg.Spec.InitProvider.Connector[i3].VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", + + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Connector[i3].VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Connector[i3].VoiceConnectorIDRef, + Selector: mg.Spec.InitProvider.Connector[i3].VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Connector[i3].VoiceConnectorID") } @@ -62,37 +90,60 @@ func (mg *VoiceConnectorGroup) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this VoiceConnectorLogging. func (mg *VoiceConnectorLogging) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, - Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + "v1beta1", + + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, + Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VoiceConnectorID") } mg.Spec.ForProvider.VoiceConnectorID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VoiceConnectorIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, - Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, + Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VoiceConnectorID") } @@ -104,37 +155,60 @@ func (mg *VoiceConnectorLogging) ResolveReferences(ctx context.Context, c client // ResolveReferences of this VoiceConnectorOrigination. func (mg *VoiceConnectorOrigination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, - Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, + Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VoiceConnectorID") } mg.Spec.ForProvider.VoiceConnectorID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VoiceConnectorIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, - Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, + Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VoiceConnectorID") } @@ -146,37 +220,60 @@ func (mg *VoiceConnectorOrigination) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this VoiceConnectorStreaming. func (mg *VoiceConnectorStreaming) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, - Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, + Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VoiceConnectorID") } mg.Spec.ForProvider.VoiceConnectorID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VoiceConnectorIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", + + "VoiceConnector", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, - Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, + Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VoiceConnectorID") } @@ -188,37 +285,60 @@ func (mg *VoiceConnectorStreaming) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this VoiceConnectorTermination. func (mg *VoiceConnectorTermination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", + + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, - Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, + Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VoiceConnectorID") } mg.Spec.ForProvider.VoiceConnectorID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VoiceConnectorIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", + + "VoiceConnector", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, - Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, + Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VoiceConnectorID") } @@ -230,37 +350,60 @@ func (mg *VoiceConnectorTermination) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this VoiceConnectorTerminationCredentials. func (mg *VoiceConnectorTerminationCredentials) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", + + "v1beta1", + + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, - Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VoiceConnectorIDRef, + Selector: mg.Spec.ForProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VoiceConnectorID") } mg.Spec.ForProvider.VoiceConnectorID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VoiceConnectorIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("chime.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, - Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, - To: reference.To{ - List: &VoiceConnectorList{}, - Managed: &VoiceConnector{}, - }, - }) + "v1beta1", + + "VoiceConnector", + + "VoiceConnectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VoiceConnectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VoiceConnectorIDRef, + Selector: mg.Spec.InitProvider.VoiceConnectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VoiceConnectorID") } diff --git a/apis/cloud9/v1beta1/zz_generated.resolvers.go b/apis/cloud9/v1beta1/zz_generated.resolvers.go index a9ede160f6..77f2d6c22e 100644 --- a/apis/cloud9/v1beta1/zz_generated.resolvers.go +++ b/apis/cloud9/v1beta1/zz_generated.resolvers.go @@ -10,44 +10,67 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this EnvironmentEC2. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this EnvironmentEC2. func (mg *EnvironmentEC2) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } @@ -59,37 +82,59 @@ func (mg *EnvironmentEC2) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this EnvironmentMembership. func (mg *EnvironmentMembership) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloud9.aws.upbound.io", + + "v1beta1", + + "EnvironmentEC2", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EnvironmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.EnvironmentIDRef, - Selector: mg.Spec.ForProvider.EnvironmentIDSelector, - To: reference.To{ - List: &EnvironmentEC2List{}, - Managed: &EnvironmentEC2{}, - }, - }) + "EnvironmentEC2List") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EnvironmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.EnvironmentIDRef, + Selector: mg.Spec.ForProvider.EnvironmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EnvironmentID") } mg.Spec.ForProvider.EnvironmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EnvironmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.UserArnRef, - Selector: mg.Spec.ForProvider.UserArnSelector, - To: reference.To{ - List: &v1beta11.UserList{}, - Managed: &v1beta11.User{}, - }, - }) + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.UserArnRef, + Selector: mg.Spec.ForProvider.UserArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserArn") } diff --git a/apis/cloudcontrol/v1beta1/zz_generated.resolvers.go b/apis/cloudcontrol/v1beta1/zz_generated.resolvers.go index 1dd2dc5ed0..163c02d81d 100644 --- a/apis/cloudcontrol/v1beta1/zz_generated.resolvers.go +++ b/apis/cloudcontrol/v1beta1/zz_generated.resolvers.go @@ -9,44 +9,70 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Resource. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Resource. func (mg *Resource) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/cloudformation/v1beta1/zz_generated.resolvers.go b/apis/cloudformation/v1beta1/zz_generated.resolvers.go index 8841e90140..ced94f2f4e 100644 --- a/apis/cloudformation/v1beta1/zz_generated.resolvers.go +++ b/apis/cloudformation/v1beta1/zz_generated.resolvers.go @@ -9,44 +9,70 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Stack. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Stack. func (mg *Stack) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMRoleArnRef, - Selector: mg.Spec.ForProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMRoleArnRef, + Selector: mg.Spec.ForProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoleArn") } mg.Spec.ForProvider.IAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMRoleArnRef, - Selector: mg.Spec.InitProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMRoleArnRef, + Selector: mg.Spec.InitProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoleArn") } @@ -58,37 +84,60 @@ func (mg *Stack) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this StackSet. func (mg *StackSet) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AdministrationRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.AdministrationRoleArnRef, - Selector: mg.Spec.ForProvider.AdministrationRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AdministrationRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.AdministrationRoleArnRef, + Selector: mg.Spec.ForProvider.AdministrationRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AdministrationRoleArn") } mg.Spec.ForProvider.AdministrationRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AdministrationRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AdministrationRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.AdministrationRoleArnRef, - Selector: mg.Spec.InitProvider.AdministrationRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AdministrationRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.AdministrationRoleArnRef, + Selector: mg.Spec.InitProvider.AdministrationRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AdministrationRoleArn") } diff --git a/apis/cloudfront/v1beta1/zz_generated.resolvers.go b/apis/cloudfront/v1beta1/zz_generated.resolvers.go index 9238447f2e..9c68ca1e03 100644 --- a/apis/cloudfront/v1beta1/zz_generated.resolvers.go +++ b/apis/cloudfront/v1beta1/zz_generated.resolvers.go @@ -10,15 +10,19 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Distribution. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Distribution. func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -26,16 +30,27 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) for i3 := 0; i3 < len(mg.Spec.ForProvider.OrderedCacheBehavior); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.OrderedCacheBehavior[i3].FunctionAssociation); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArnRef, - Selector: mg.Spec.ForProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArnSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "Function", + + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArnRef, + Selector: mg.Spec.ForProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArn") } @@ -46,16 +61,26 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.ForProvider.OrderedCacheBehavior); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArn), - Extract: resource.ExtractParamPath("qualified_arn", true), - Reference: mg.Spec.ForProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArnRef, - Selector: mg.Spec.ForProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArnSelector, - To: reference.To{ - List: &v1beta1.FunctionList{}, - Managed: &v1beta1.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArn), + Extract: resource.ExtractParamPath("qualified_arn", true), + Reference: mg.Spec.ForProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArnRef, + Selector: mg.Spec.ForProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArn") } @@ -65,16 +90,28 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) } } for i3 := 0; i3 < len(mg.Spec.ForProvider.Origin); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Origin[i3].OriginAccessControlID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Origin[i3].OriginAccessControlIDRef, - Selector: mg.Spec.ForProvider.Origin[i3].OriginAccessControlIDSelector, - To: reference.To{ - List: &OriginAccessControlList{}, - Managed: &OriginAccessControl{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "OriginAccessControl", + + "OriginAccessControlList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Origin[i3].OriginAccessControlID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Origin[i3].OriginAccessControlIDRef, + Selector: mg.Spec.ForProvider.Origin[i3].OriginAccessControlIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Origin[i3].OriginAccessControlID") } @@ -84,16 +121,28 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.ForProvider.Origin); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Origin[i3].S3OriginConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentity), - Extract: resource.ExtractParamPath("cloudfront_access_identity_path", true), - Reference: mg.Spec.ForProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentityRef, - Selector: mg.Spec.ForProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentitySelector, - To: reference.To{ - List: &OriginAccessIdentityList{}, - Managed: &OriginAccessIdentity{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "OriginAccessIdentity", + + "OriginAccessIdentityList") + if err != nil { + return errors.Wrap( + err, "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentity), + Extract: resource.ExtractParamPath("cloudfront_access_identity_path", true), + Reference: mg.Spec.ForProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentityRef, + Selector: mg.Spec.ForProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentitySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentity") } @@ -104,16 +153,27 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.InitProvider.OrderedCacheBehavior); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.OrderedCacheBehavior[i3].FunctionAssociation); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArnRef, - Selector: mg.Spec.InitProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArnSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "Function", + + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArnRef, + Selector: mg.Spec.InitProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OrderedCacheBehavior[i3].FunctionAssociation[i4].FunctionArn") } @@ -124,16 +184,26 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.InitProvider.OrderedCacheBehavior); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArn), - Extract: resource.ExtractParamPath("qualified_arn", true), - Reference: mg.Spec.InitProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArnRef, - Selector: mg.Spec.InitProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArnSelector, - To: reference.To{ - List: &v1beta1.FunctionList{}, - Managed: &v1beta1.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArn), + Extract: resource.ExtractParamPath("qualified_arn", true), + Reference: mg.Spec.InitProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArnRef, + Selector: mg.Spec.InitProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OrderedCacheBehavior[i3].LambdaFunctionAssociation[i4].LambdaArn") } @@ -143,16 +213,28 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) } } for i3 := 0; i3 < len(mg.Spec.InitProvider.Origin); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Origin[i3].OriginAccessControlID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Origin[i3].OriginAccessControlIDRef, - Selector: mg.Spec.InitProvider.Origin[i3].OriginAccessControlIDSelector, - To: reference.To{ - List: &OriginAccessControlList{}, - Managed: &OriginAccessControl{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "OriginAccessControl", + + "OriginAccessControlList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Origin[i3].OriginAccessControlID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Origin[i3].OriginAccessControlIDRef, + Selector: mg.Spec.InitProvider.Origin[i3].OriginAccessControlIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Origin[i3].OriginAccessControlID") } @@ -162,16 +244,28 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.InitProvider.Origin); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Origin[i3].S3OriginConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentity), - Extract: resource.ExtractParamPath("cloudfront_access_identity_path", true), - Reference: mg.Spec.InitProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentityRef, - Selector: mg.Spec.InitProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentitySelector, - To: reference.To{ - List: &OriginAccessIdentityList{}, - Managed: &OriginAccessIdentity{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "OriginAccessIdentity", + + "OriginAccessIdentityList") + if err != nil { + return errors.Wrap( + err, "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentity), + Extract: resource.ExtractParamPath("cloudfront_access_identity_path", true), + Reference: mg.Spec.InitProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentityRef, + Selector: mg.Spec.InitProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentitySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Origin[i3].S3OriginConfig[i4].OriginAccessIdentity") } @@ -186,6 +280,9 @@ func (mg *Distribution) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this FieldLevelEncryptionConfig. func (mg *FieldLevelEncryptionConfig) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -194,16 +291,26 @@ func (mg *FieldLevelEncryptionConfig) ResolveReferences(ctx context.Context, c c for i3 := 0; i3 < len(mg.Spec.ForProvider.QueryArgProfileConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileIDRef, - Selector: mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileIDSelector, - To: reference.To{ - List: &FieldLevelEncryptionProfileList{}, - Managed: &FieldLevelEncryptionProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "FieldLevelEncryptionProfile", + + "FieldLevelEncryptionProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileIDRef, + Selector: mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileID") } @@ -216,16 +323,26 @@ func (mg *FieldLevelEncryptionConfig) ResolveReferences(ctx context.Context, c c for i3 := 0; i3 < len(mg.Spec.InitProvider.QueryArgProfileConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileIDRef, - Selector: mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileIDSelector, - To: reference.To{ - List: &FieldLevelEncryptionProfileList{}, - Managed: &FieldLevelEncryptionProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "FieldLevelEncryptionProfile", + + "FieldLevelEncryptionProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileIDRef, + Selector: mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.QueryArgProfileConfig[i3].QueryArgProfiles[i4].Items[i5].ProfileID") } @@ -241,6 +358,9 @@ func (mg *FieldLevelEncryptionConfig) ResolveReferences(ctx context.Context, c c // ResolveReferences of this FieldLevelEncryptionProfile. func (mg *FieldLevelEncryptionProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -248,16 +368,27 @@ func (mg *FieldLevelEncryptionProfile) ResolveReferences(ctx context.Context, c for i3 := 0; i3 < len(mg.Spec.ForProvider.EncryptionEntities); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.EncryptionEntities[i3].Items); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionEntities[i3].Items[i4].PublicKeyID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.EncryptionEntities[i3].Items[i4].PublicKeyIDRef, - Selector: mg.Spec.ForProvider.EncryptionEntities[i3].Items[i4].PublicKeyIDSelector, - To: reference.To{ - List: &PublicKeyList{}, - Managed: &PublicKey{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "PublicKey", + + "PublicKeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionEntities[i3].Items[i4].PublicKeyID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.EncryptionEntities[i3].Items[i4].PublicKeyIDRef, + Selector: mg.Spec.ForProvider.EncryptionEntities[i3].Items[i4].PublicKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EncryptionEntities[i3].Items[i4].PublicKeyID") } @@ -268,16 +399,27 @@ func (mg *FieldLevelEncryptionProfile) ResolveReferences(ctx context.Context, c } for i3 := 0; i3 < len(mg.Spec.InitProvider.EncryptionEntities); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.EncryptionEntities[i3].Items); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionEntities[i3].Items[i4].PublicKeyID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.EncryptionEntities[i3].Items[i4].PublicKeyIDRef, - Selector: mg.Spec.InitProvider.EncryptionEntities[i3].Items[i4].PublicKeyIDSelector, - To: reference.To{ - List: &PublicKeyList{}, - Managed: &PublicKey{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "PublicKey", + + "PublicKeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionEntities[i3].Items[i4].PublicKeyID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.EncryptionEntities[i3].Items[i4].PublicKeyIDRef, + Selector: mg.Spec.InitProvider.EncryptionEntities[i3].Items[i4].PublicKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EncryptionEntities[i3].Items[i4].PublicKeyID") } @@ -292,37 +434,60 @@ func (mg *FieldLevelEncryptionProfile) ResolveReferences(ctx context.Context, c // ResolveReferences of this KeyGroup. func (mg *KeyGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "PublicKey", + + "PublicKeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Items), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.ItemRefs, - Selector: mg.Spec.ForProvider.ItemSelector, - To: reference.To{ - List: &PublicKeyList{}, - Managed: &PublicKey{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Items), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.ItemRefs, + Selector: mg.Spec.ForProvider.ItemSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Items") } mg.Spec.ForProvider.Items = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.ItemRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Items), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.ItemRefs, - Selector: mg.Spec.InitProvider.ItemSelector, - To: reference.To{ - List: &PublicKeyList{}, - Managed: &PublicKey{}, - }, - }) + "v1beta1", + + "PublicKey", + + "PublicKeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Items), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.ItemRefs, + Selector: mg.Spec.InitProvider.ItemSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Items") } @@ -334,37 +499,58 @@ func (mg *KeyGroup) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this MonitoringSubscription. func (mg *MonitoringSubscription) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", + + "Distribution", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DistributionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DistributionIDRef, - Selector: mg.Spec.ForProvider.DistributionIDSelector, - To: reference.To{ - List: &DistributionList{}, - Managed: &Distribution{}, - }, - }) + "DistributionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DistributionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DistributionIDRef, + Selector: mg.Spec.ForProvider.DistributionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DistributionID") } mg.Spec.ForProvider.DistributionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DistributionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudfront.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DistributionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DistributionIDRef, - Selector: mg.Spec.InitProvider.DistributionIDSelector, - To: reference.To{ - List: &DistributionList{}, - Managed: &Distribution{}, - }, - }) + "Distribution", + + "DistributionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DistributionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DistributionIDRef, + Selector: mg.Spec.InitProvider.DistributionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DistributionID") } @@ -376,6 +562,9 @@ func (mg *MonitoringSubscription) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this RealtimeLogConfig. func (mg *RealtimeLogConfig) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -383,16 +572,27 @@ func (mg *RealtimeLogConfig) ResolveReferences(ctx context.Context, c client.Rea for i3 := 0; i3 < len(mg.Spec.ForProvider.Endpoint); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArn") } @@ -403,16 +603,26 @@ func (mg *RealtimeLogConfig) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.ForProvider.Endpoint); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArnRef, - Selector: mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArnSelector, - To: reference.To{ - List: &v1beta12.StreamList{}, - Managed: &v1beta12.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArnRef, + Selector: mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArn") } @@ -423,16 +633,27 @@ func (mg *RealtimeLogConfig) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.InitProvider.Endpoint); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].RoleArn") } @@ -443,16 +664,26 @@ func (mg *RealtimeLogConfig) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.InitProvider.Endpoint); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArnRef, - Selector: mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArnSelector, - To: reference.To{ - List: &v1beta12.StreamList{}, - Managed: &v1beta12.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArnRef, + Selector: mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Endpoint[i3].KinesisStreamConfig[i4].StreamArn") } diff --git a/apis/cloudsearch/v1beta1/zz_generated.resolvers.go b/apis/cloudsearch/v1beta1/zz_generated.resolvers.go index 915c3b93d1..3c5a918b92 100644 --- a/apis/cloudsearch/v1beta1/zz_generated.resolvers.go +++ b/apis/cloudsearch/v1beta1/zz_generated.resolvers.go @@ -8,44 +8,68 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this DomainServiceAccessPolicy. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this DomainServiceAccessPolicy. func (mg *DomainServiceAccessPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudsearch.aws.upbound.io", + + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DomainNameRef, - Selector: mg.Spec.ForProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DomainNameRef, + Selector: mg.Spec.ForProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainName") } mg.Spec.ForProvider.DomainName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudsearch.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DomainNameRef, - Selector: mg.Spec.InitProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DomainNameRef, + Selector: mg.Spec.InitProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainName") } diff --git a/apis/cloudtrail/v1beta1/zz_generated.resolvers.go b/apis/cloudtrail/v1beta1/zz_generated.resolvers.go index 2513475acb..7ccc59bf6d 100644 --- a/apis/cloudtrail/v1beta1/zz_generated.resolvers.go +++ b/apis/cloudtrail/v1beta1/zz_generated.resolvers.go @@ -10,46 +10,66 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this EventDataStore. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this EventDataStore. func (mg *EventDataStore) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -61,101 +81,158 @@ func (mg *EventDataStore) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this Trail. func (mg *Trail) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudWatchLogsRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.CloudWatchLogsRoleArnRef, - Selector: mg.Spec.ForProvider.CloudWatchLogsRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudWatchLogsRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.CloudWatchLogsRoleArnRef, + Selector: mg.Spec.ForProvider.CloudWatchLogsRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CloudWatchLogsRoleArn") } mg.Spec.ForProvider.CloudWatchLogsRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CloudWatchLogsRoleArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3BucketName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.S3BucketNameRef, - Selector: mg.Spec.ForProvider.S3BucketNameSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3BucketName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.S3BucketNameRef, + Selector: mg.Spec.ForProvider.S3BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3BucketName") } mg.Spec.ForProvider.S3BucketName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.S3BucketNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudWatchLogsRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.CloudWatchLogsRoleArnRef, - Selector: mg.Spec.InitProvider.CloudWatchLogsRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudWatchLogsRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.CloudWatchLogsRoleArnRef, + Selector: mg.Spec.InitProvider.CloudWatchLogsRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CloudWatchLogsRoleArn") } mg.Spec.InitProvider.CloudWatchLogsRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CloudWatchLogsRoleArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3BucketName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.S3BucketNameRef, - Selector: mg.Spec.InitProvider.S3BucketNameSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3BucketName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.S3BucketNameRef, + Selector: mg.Spec.InitProvider.S3BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.S3BucketName") } diff --git a/apis/cloudwatch/v1beta1/zz_generated.resolvers.go b/apis/cloudwatch/v1beta1/zz_generated.resolvers.go index 5cee2f33ef..06d29f23f9 100644 --- a/apis/cloudwatch/v1beta1/zz_generated.resolvers.go +++ b/apis/cloudwatch/v1beta1/zz_generated.resolvers.go @@ -10,78 +10,118 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/firehose/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this CompositeAlarm. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this CompositeAlarm. func (mg *CompositeAlarm) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.AlarmActions), - Extract: resource.ExtractParamPath("arn", true), - References: mg.Spec.ForProvider.AlarmActionsRefs, - Selector: mg.Spec.ForProvider.AlarmActionsSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.AlarmActions), + Extract: resource.ExtractParamPath("arn", true), + References: mg.Spec.ForProvider.AlarmActionsRefs, + Selector: mg.Spec.ForProvider.AlarmActionsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AlarmActions") } mg.Spec.ForProvider.AlarmActions = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.AlarmActionsRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.OkActions), - Extract: resource.ExtractParamPath("arn", true), - References: mg.Spec.ForProvider.OkActionsRefs, - Selector: mg.Spec.ForProvider.OkActionsSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.OkActions), + Extract: resource.ExtractParamPath("arn", true), + References: mg.Spec.ForProvider.OkActionsRefs, + Selector: mg.Spec.ForProvider.OkActionsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OkActions") } mg.Spec.ForProvider.OkActions = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.OkActionsRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.AlarmActions), - Extract: resource.ExtractParamPath("arn", true), - References: mg.Spec.InitProvider.AlarmActionsRefs, - Selector: mg.Spec.InitProvider.AlarmActionsSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.AlarmActions), + Extract: resource.ExtractParamPath("arn", true), + References: mg.Spec.InitProvider.AlarmActionsRefs, + Selector: mg.Spec.InitProvider.AlarmActionsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AlarmActions") } mg.Spec.InitProvider.AlarmActions = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.AlarmActionsRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.OkActions), - Extract: resource.ExtractParamPath("arn", true), - References: mg.Spec.InitProvider.OkActionsRefs, - Selector: mg.Spec.InitProvider.OkActionsSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.OkActions), + Extract: resource.ExtractParamPath("arn", true), + References: mg.Spec.InitProvider.OkActionsRefs, + Selector: mg.Spec.InitProvider.OkActionsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OkActions") } @@ -93,69 +133,110 @@ func (mg *CompositeAlarm) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this MetricStream. func (mg *MetricStream) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirehoseArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.FirehoseArnRef, - Selector: mg.Spec.ForProvider.FirehoseArnSelector, - To: reference.To{ - List: &v1beta11.DeliveryStreamList{}, - Managed: &v1beta11.DeliveryStream{}, - }, - }) + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirehoseArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.FirehoseArnRef, + Selector: mg.Spec.ForProvider.FirehoseArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FirehoseArn") } mg.Spec.ForProvider.FirehoseArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FirehoseArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirehoseArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.FirehoseArnRef, - Selector: mg.Spec.InitProvider.FirehoseArnSelector, - To: reference.To{ - List: &v1beta11.DeliveryStreamList{}, - Managed: &v1beta11.DeliveryStream{}, - }, - }) + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirehoseArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.FirehoseArnRef, + Selector: mg.Spec.InitProvider.FirehoseArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FirehoseArn") } mg.Spec.InitProvider.FirehoseArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.FirehoseArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/cloudwatchevents/v1beta1/zz_generated.resolvers.go b/apis/cloudwatchevents/v1beta1/zz_generated.resolvers.go index 226eb0b6cf..166022cca6 100644 --- a/apis/cloudwatchevents/v1beta1/zz_generated.resolvers.go +++ b/apis/cloudwatchevents/v1beta1/zz_generated.resolvers.go @@ -10,46 +10,66 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/ecs/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/organizations/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this APIDestination. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this APIDestination. func (mg *APIDestination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ConnectionArnRef, - Selector: mg.Spec.ForProvider.ConnectionArnSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ConnectionArnRef, + Selector: mg.Spec.ForProvider.ConnectionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionArn") } mg.Spec.ForProvider.ConnectionArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ConnectionArnRef, - Selector: mg.Spec.InitProvider.ConnectionArnSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ConnectionArnRef, + Selector: mg.Spec.InitProvider.ConnectionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionArn") } @@ -61,37 +81,58 @@ func (mg *APIDestination) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this Archive. func (mg *Archive) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventSourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.EventSourceArnRef, - Selector: mg.Spec.ForProvider.EventSourceArnSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventSourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.EventSourceArnRef, + Selector: mg.Spec.ForProvider.EventSourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventSourceArn") } mg.Spec.ForProvider.EventSourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EventSourceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventSourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.EventSourceArnRef, - Selector: mg.Spec.InitProvider.EventSourceArnSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventSourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.EventSourceArnRef, + Selector: mg.Spec.InitProvider.EventSourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventSourceArn") } @@ -103,37 +144,58 @@ func (mg *Archive) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this BusPolicy. func (mg *BusPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventBusName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EventBusNameRef, - Selector: mg.Spec.ForProvider.EventBusNameSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventBusName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EventBusNameRef, + Selector: mg.Spec.ForProvider.EventBusNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventBusName") } mg.Spec.ForProvider.EventBusName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EventBusNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventBusName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EventBusNameRef, - Selector: mg.Spec.InitProvider.EventBusNameSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventBusName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EventBusNameRef, + Selector: mg.Spec.InitProvider.EventBusNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventBusName") } @@ -145,22 +207,34 @@ func (mg *BusPolicy) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this Permission. func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Condition); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Condition[i3].Value), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Condition[i3].ValueRef, - Selector: mg.Spec.ForProvider.Condition[i3].ValueSelector, - To: reference.To{ - List: &v1beta1.OrganizationList{}, - Managed: &v1beta1.Organization{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("organizations.aws.upbound.io", + + "v1beta1", + "Organization", + + "OrganizationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Condition[i3].Value), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Condition[i3].ValueRef, + Selector: mg.Spec.ForProvider.Condition[i3].ValueSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Condition[i3].Value") } @@ -168,16 +242,26 @@ func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.ForProvider.Condition[i3].ValueRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventBusName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EventBusNameRef, - Selector: mg.Spec.ForProvider.EventBusNameSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventBusName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EventBusNameRef, + Selector: mg.Spec.ForProvider.EventBusNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventBusName") } @@ -185,16 +269,25 @@ func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.ForProvider.EventBusNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.Condition); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Condition[i3].Value), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Condition[i3].ValueRef, - Selector: mg.Spec.InitProvider.Condition[i3].ValueSelector, - To: reference.To{ - List: &v1beta1.OrganizationList{}, - Managed: &v1beta1.Organization{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("organizations.aws.upbound.io", + + "v1beta1", + "Organization", + + "OrganizationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Condition[i3].Value), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Condition[i3].ValueRef, + Selector: mg.Spec.InitProvider.Condition[i3].ValueSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Condition[i3].Value") } @@ -202,16 +295,26 @@ func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.InitProvider.Condition[i3].ValueRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventBusName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EventBusNameRef, - Selector: mg.Spec.InitProvider.EventBusNameSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventBusName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EventBusNameRef, + Selector: mg.Spec.InitProvider.EventBusNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventBusName") } @@ -223,69 +326,110 @@ func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Rule. func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventBusName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EventBusNameRef, - Selector: mg.Spec.ForProvider.EventBusNameSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventBusName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EventBusNameRef, + Selector: mg.Spec.ForProvider.EventBusNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventBusName") } mg.Spec.ForProvider.EventBusName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EventBusNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventBusName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EventBusNameRef, - Selector: mg.Spec.InitProvider.EventBusNameSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventBusName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EventBusNameRef, + Selector: mg.Spec.InitProvider.EventBusNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventBusName") } mg.Spec.InitProvider.EventBusName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.EventBusNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -297,22 +441,36 @@ func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this Target. func (mg *Target) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.EcsTarget); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EcsTarget[i3].TaskDefinitionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.EcsTarget[i3].TaskDefinitionArnRef, - Selector: mg.Spec.ForProvider.EcsTarget[i3].TaskDefinitionArnSelector, - To: reference.To{ - List: &v1beta12.TaskDefinitionList{}, - Managed: &v1beta12.TaskDefinition{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "TaskDefinition", + + "TaskDefinitionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EcsTarget[i3].TaskDefinitionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.EcsTarget[i3].TaskDefinitionArnRef, + Selector: mg.Spec.ForProvider.EcsTarget[i3].TaskDefinitionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EcsTarget[i3].TaskDefinitionArn") } @@ -320,48 +478,76 @@ func (mg *Target) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.EcsTarget[i3].TaskDefinitionArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventBusName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EventBusNameRef, - Selector: mg.Spec.ForProvider.EventBusNameSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventBusName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EventBusNameRef, + Selector: mg.Spec.ForProvider.EventBusNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventBusName") } mg.Spec.ForProvider.EventBusName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EventBusNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Rule", + + "RuleList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RuleRef, - Selector: mg.Spec.ForProvider.RuleSelector, - To: reference.To{ - List: &RuleList{}, - Managed: &Rule{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RuleRef, + Selector: mg.Spec.ForProvider.RuleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Rule") } @@ -369,16 +555,27 @@ func (mg *Target) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.RuleRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.EcsTarget); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EcsTarget[i3].TaskDefinitionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.EcsTarget[i3].TaskDefinitionArnRef, - Selector: mg.Spec.InitProvider.EcsTarget[i3].TaskDefinitionArnSelector, - To: reference.To{ - List: &v1beta12.TaskDefinitionList{}, - Managed: &v1beta12.TaskDefinition{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "TaskDefinition", + + "TaskDefinitionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EcsTarget[i3].TaskDefinitionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.EcsTarget[i3].TaskDefinitionArnRef, + Selector: mg.Spec.InitProvider.EcsTarget[i3].TaskDefinitionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EcsTarget[i3].TaskDefinitionArn") } @@ -386,48 +583,76 @@ func (mg *Target) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.EcsTarget[i3].TaskDefinitionArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventBusName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EventBusNameRef, - Selector: mg.Spec.InitProvider.EventBusNameSelector, - To: reference.To{ - List: &BusList{}, - Managed: &Bus{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventBusName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EventBusNameRef, + Selector: mg.Spec.InitProvider.EventBusNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventBusName") } mg.Spec.InitProvider.EventBusName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.EventBusNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } mg.Spec.InitProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Rule", + + "RuleList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RuleRef, - Selector: mg.Spec.InitProvider.RuleSelector, - To: reference.To{ - List: &RuleList{}, - Managed: &Rule{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RuleRef, + Selector: mg.Spec.InitProvider.RuleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Rule") } diff --git a/apis/cloudwatchlogs/v1beta1/zz_generated.resolvers.go b/apis/cloudwatchlogs/v1beta1/zz_generated.resolvers.go index 72b0d0598d..0e9ee05d89 100644 --- a/apis/cloudwatchlogs/v1beta1/zz_generated.resolvers.go +++ b/apis/cloudwatchlogs/v1beta1/zz_generated.resolvers.go @@ -9,78 +9,120 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Destination. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Destination. func (mg *Destination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.TargetArnRef, - Selector: mg.Spec.ForProvider.TargetArnSelector, - To: reference.To{ - List: &v1beta11.StreamList{}, - Managed: &v1beta11.Stream{}, - }, - }) + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.TargetArnRef, + Selector: mg.Spec.ForProvider.TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetArn") } mg.Spec.ForProvider.TargetArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } mg.Spec.InitProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.TargetArnRef, - Selector: mg.Spec.InitProvider.TargetArnSelector, - To: reference.To{ - List: &v1beta11.StreamList{}, - Managed: &v1beta11.Stream{}, - }, - }) + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.TargetArnRef, + Selector: mg.Spec.InitProvider.TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetArn") } @@ -92,37 +134,56 @@ func (mg *Destination) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Group. func (mg *Group) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -134,37 +195,58 @@ func (mg *Group) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this MetricFilter. func (mg *MetricFilter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LogGroupNameRef, - Selector: mg.Spec.ForProvider.LogGroupNameSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LogGroupNameRef, + Selector: mg.Spec.ForProvider.LogGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LogGroupName") } mg.Spec.ForProvider.LogGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LogGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LogGroupNameRef, - Selector: mg.Spec.InitProvider.LogGroupNameSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LogGroupNameRef, + Selector: mg.Spec.InitProvider.LogGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LogGroupName") } @@ -176,37 +258,58 @@ func (mg *MetricFilter) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Stream. func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LogGroupNameRef, - Selector: mg.Spec.ForProvider.LogGroupNameSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LogGroupNameRef, + Selector: mg.Spec.ForProvider.LogGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LogGroupName") } mg.Spec.ForProvider.LogGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LogGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LogGroupNameRef, - Selector: mg.Spec.InitProvider.LogGroupNameSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LogGroupNameRef, + Selector: mg.Spec.InitProvider.LogGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LogGroupName") } @@ -218,69 +321,110 @@ func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this SubscriptionFilter. func (mg *SubscriptionFilter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.DestinationArnRef, - Selector: mg.Spec.ForProvider.DestinationArnSelector, - To: reference.To{ - List: &v1beta11.StreamList{}, - Managed: &v1beta11.Stream{}, - }, - }) + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.DestinationArnRef, + Selector: mg.Spec.ForProvider.DestinationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DestinationArn") } mg.Spec.ForProvider.DestinationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DestinationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.DestinationArnRef, - Selector: mg.Spec.InitProvider.DestinationArnSelector, - To: reference.To{ - List: &v1beta11.StreamList{}, - Managed: &v1beta11.Stream{}, - }, - }) + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.DestinationArnRef, + Selector: mg.Spec.InitProvider.DestinationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DestinationArn") } mg.Spec.InitProvider.DestinationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DestinationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/codecommit/v1beta1/zz_generated.resolvers.go b/apis/codecommit/v1beta1/zz_generated.resolvers.go index 2990f2597b..286d85c846 100644 --- a/apis/codecommit/v1beta1/zz_generated.resolvers.go +++ b/apis/codecommit/v1beta1/zz_generated.resolvers.go @@ -10,43 +10,69 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ApprovalRuleTemplateAssociation. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ApprovalRuleTemplateAssociation. func (mg *ApprovalRuleTemplateAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("codecommit.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApprovalRuleTemplateName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ApprovalRuleTemplateNameRef, - Selector: mg.Spec.ForProvider.ApprovalRuleTemplateNameSelector, - To: reference.To{ - List: &ApprovalRuleTemplateList{}, - Managed: &ApprovalRuleTemplate{}, - }, - }) + "ApprovalRuleTemplate", + + "ApprovalRuleTemplateList") + if err != nil { + return errors.Wrap( + err, "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApprovalRuleTemplateName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ApprovalRuleTemplateNameRef, + Selector: mg.Spec.ForProvider.ApprovalRuleTemplateNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApprovalRuleTemplateName") } mg.Spec.ForProvider.ApprovalRuleTemplateName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApprovalRuleTemplateNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("codecommit.aws.upbound.io", + + "v1beta1", + + "Repository", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RepositoryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RepositoryNameRef, - Selector: mg.Spec.ForProvider.RepositoryNameSelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + "RepositoryList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RepositoryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RepositoryNameRef, + Selector: mg.Spec.ForProvider.RepositoryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RepositoryName") } @@ -58,21 +84,33 @@ func (mg *ApprovalRuleTemplateAssociation) ResolveReferences(ctx context.Context // ResolveReferences of this Trigger. func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("codecommit.aws.upbound.io", + + "v1beta1", + + "Repository", + + "RepositoryList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RepositoryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RepositoryNameRef, - Selector: mg.Spec.ForProvider.RepositoryNameSelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RepositoryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RepositoryNameRef, + Selector: mg.Spec.ForProvider.RepositoryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RepositoryName") } @@ -80,16 +118,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.RepositoryNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.Trigger); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Trigger[i3].DestinationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Trigger[i3].DestinationArnRef, - Selector: mg.Spec.ForProvider.Trigger[i3].DestinationArnSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Trigger[i3].DestinationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Trigger[i3].DestinationArnRef, + Selector: mg.Spec.ForProvider.Trigger[i3].DestinationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Trigger[i3].DestinationArn") } @@ -97,16 +145,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.Trigger[i3].DestinationArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RepositoryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RepositoryNameRef, - Selector: mg.Spec.InitProvider.RepositoryNameSelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("codecommit.aws.upbound.io", + + "v1beta1", + + "Repository", + + "RepositoryList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RepositoryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RepositoryNameRef, + Selector: mg.Spec.InitProvider.RepositoryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RepositoryName") } @@ -114,16 +172,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.RepositoryNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.Trigger); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Trigger[i3].DestinationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Trigger[i3].DestinationArnRef, - Selector: mg.Spec.InitProvider.Trigger[i3].DestinationArnSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Trigger[i3].DestinationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Trigger[i3].DestinationArnRef, + Selector: mg.Spec.InitProvider.Trigger[i3].DestinationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Trigger[i3].DestinationArn") } diff --git a/apis/codepipeline/v1beta1/zz_generated.resolvers.go b/apis/codepipeline/v1beta1/zz_generated.resolvers.go index c3613a552a..ff9b04ba81 100644 --- a/apis/codepipeline/v1beta1/zz_generated.resolvers.go +++ b/apis/codepipeline/v1beta1/zz_generated.resolvers.go @@ -9,30 +9,45 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Codepipeline. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Codepipeline. func (mg *Codepipeline) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.ArtifactStore); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ArtifactStore[i3].Location), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ArtifactStore[i3].LocationRef, - Selector: mg.Spec.ForProvider.ArtifactStore[i3].LocationSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ArtifactStore[i3].Location), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ArtifactStore[i3].LocationRef, + Selector: mg.Spec.ForProvider.ArtifactStore[i3].LocationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ArtifactStore[i3].Location") } @@ -40,16 +55,27 @@ func (mg *Codepipeline) ResolveReferences(ctx context.Context, c client.Reader) mg.Spec.ForProvider.ArtifactStore[i3].LocationRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } @@ -57,16 +83,26 @@ func (mg *Codepipeline) ResolveReferences(ctx context.Context, c client.Reader) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.ArtifactStore); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ArtifactStore[i3].Location), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ArtifactStore[i3].LocationRef, - Selector: mg.Spec.InitProvider.ArtifactStore[i3].LocationSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ArtifactStore[i3].Location), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ArtifactStore[i3].LocationRef, + Selector: mg.Spec.InitProvider.ArtifactStore[i3].LocationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ArtifactStore[i3].Location") } @@ -74,16 +110,27 @@ func (mg *Codepipeline) ResolveReferences(ctx context.Context, c client.Reader) mg.Spec.InitProvider.ArtifactStore[i3].LocationRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -95,37 +142,58 @@ func (mg *Codepipeline) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Webhook. func (mg *Webhook) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("codepipeline.aws.upbound.io", + + "v1beta1", + + "Codepipeline", + + "CodepipelineList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetPipeline), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TargetPipelineRef, - Selector: mg.Spec.ForProvider.TargetPipelineSelector, - To: reference.To{ - List: &CodepipelineList{}, - Managed: &Codepipeline{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetPipeline), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TargetPipelineRef, + Selector: mg.Spec.ForProvider.TargetPipelineSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetPipeline") } mg.Spec.ForProvider.TargetPipeline = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetPipelineRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("codepipeline.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetPipeline), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TargetPipelineRef, - Selector: mg.Spec.InitProvider.TargetPipelineSelector, - To: reference.To{ - List: &CodepipelineList{}, - Managed: &Codepipeline{}, - }, - }) + "v1beta1", + + "Codepipeline", + + "CodepipelineList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetPipeline), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TargetPipelineRef, + Selector: mg.Spec.InitProvider.TargetPipelineSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetPipeline") } diff --git a/apis/codestarnotifications/v1beta1/zz_generated.resolvers.go b/apis/codestarnotifications/v1beta1/zz_generated.resolvers.go index cd360bd719..656098bc3b 100644 --- a/apis/codestarnotifications/v1beta1/zz_generated.resolvers.go +++ b/apis/codestarnotifications/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,42 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/codecommit/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this NotificationRule. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this NotificationRule. func (mg *NotificationRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("codecommit.aws.upbound.io", + + "v1beta1", + + "Repository", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Resource), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceRef, - Selector: mg.Spec.ForProvider.ResourceSelector, - To: reference.To{ - List: &v1beta1.RepositoryList{}, - Managed: &v1beta1.Repository{}, - }, - }) + "RepositoryList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Resource), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceRef, + Selector: mg.Spec.ForProvider.ResourceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Resource") } @@ -39,16 +53,26 @@ func (mg *NotificationRule) ResolveReferences(ctx context.Context, c client.Read mg.Spec.ForProvider.ResourceRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.Target); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target[i3].Address), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Target[i3].AddressRef, - Selector: mg.Spec.ForProvider.Target[i3].AddressSelector, - To: reference.To{ - List: &v1beta11.TopicList{}, - Managed: &v1beta11.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target[i3].Address), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Target[i3].AddressRef, + Selector: mg.Spec.ForProvider.Target[i3].AddressSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Target[i3].Address") } @@ -56,16 +80,26 @@ func (mg *NotificationRule) ResolveReferences(ctx context.Context, c client.Read mg.Spec.ForProvider.Target[i3].AddressRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Resource), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceRef, - Selector: mg.Spec.InitProvider.ResourceSelector, - To: reference.To{ - List: &v1beta1.RepositoryList{}, - Managed: &v1beta1.Repository{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("codecommit.aws.upbound.io", + + "v1beta1", + + "Repository", + + "RepositoryList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Resource), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceRef, + Selector: mg.Spec.InitProvider.ResourceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Resource") } @@ -73,16 +107,26 @@ func (mg *NotificationRule) ResolveReferences(ctx context.Context, c client.Read mg.Spec.InitProvider.ResourceRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.Target); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target[i3].Address), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Target[i3].AddressRef, - Selector: mg.Spec.InitProvider.Target[i3].AddressSelector, - To: reference.To{ - List: &v1beta11.TopicList{}, - Managed: &v1beta11.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target[i3].Address), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Target[i3].AddressRef, + Selector: mg.Spec.InitProvider.Target[i3].AddressSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Target[i3].Address") } diff --git a/apis/cognitoidentity/v1beta1/zz_generated.resolvers.go b/apis/cognitoidentity/v1beta1/zz_generated.resolvers.go index 5a69285fd3..75ef49c5fa 100644 --- a/apis/cognitoidentity/v1beta1/zz_generated.resolvers.go +++ b/apis/cognitoidentity/v1beta1/zz_generated.resolvers.go @@ -10,77 +10,120 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this CognitoIdentityPoolProviderPrincipalTag. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this CognitoIdentityPoolProviderPrincipalTag. func (mg *CognitoIdentityPoolProviderPrincipalTag) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cognitoidentity.aws.upbound.io", + + "v1beta1", + "Pool", + + "PoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IdentityPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IdentityPoolIDRef, - Selector: mg.Spec.ForProvider.IdentityPoolIDSelector, - To: reference.To{ - List: &PoolList{}, - Managed: &Pool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IdentityPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IdentityPoolIDRef, + Selector: mg.Spec.ForProvider.IdentityPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IdentityPoolID") } mg.Spec.ForProvider.IdentityPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IdentityPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IdentityProviderName), - Extract: resource.ExtractParamPath("endpoint", true), - Reference: mg.Spec.ForProvider.IdentityProviderNameRef, - Selector: mg.Spec.ForProvider.IdentityProviderNameSelector, - To: reference.To{ - List: &v1beta1.UserPoolList{}, - Managed: &v1beta1.UserPool{}, - }, - }) + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IdentityProviderName), + Extract: resource.ExtractParamPath("endpoint", true), + Reference: mg.Spec.ForProvider.IdentityProviderNameRef, + Selector: mg.Spec.ForProvider.IdentityProviderNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IdentityProviderName") } mg.Spec.ForProvider.IdentityProviderName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IdentityProviderNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidentity.aws.upbound.io", + + "v1beta1", + "Pool", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IdentityPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IdentityPoolIDRef, - Selector: mg.Spec.InitProvider.IdentityPoolIDSelector, - To: reference.To{ - List: &PoolList{}, - Managed: &Pool{}, - }, - }) + "PoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IdentityPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IdentityPoolIDRef, + Selector: mg.Spec.InitProvider.IdentityPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IdentityPoolID") } mg.Spec.InitProvider.IdentityPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IdentityPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IdentityProviderName), - Extract: resource.ExtractParamPath("endpoint", true), - Reference: mg.Spec.InitProvider.IdentityProviderNameRef, - Selector: mg.Spec.InitProvider.IdentityProviderNameSelector, - To: reference.To{ - List: &v1beta1.UserPoolList{}, - Managed: &v1beta1.UserPool{}, - }, - }) + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IdentityProviderName), + Extract: resource.ExtractParamPath("endpoint", true), + Reference: mg.Spec.InitProvider.IdentityProviderNameRef, + Selector: mg.Spec.InitProvider.IdentityProviderNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IdentityProviderName") } @@ -92,6 +135,9 @@ func (mg *CognitoIdentityPoolProviderPrincipalTag) ResolveReferences(ctx context // ResolveReferences of this Pool. func (mg *Pool) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -99,16 +145,26 @@ func (mg *Pool) ResolveReferences(ctx context.Context, c client.Reader) error { var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.CognitoIdentityProviders); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CognitoIdentityProviders[i3].ClientID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CognitoIdentityProviders[i3].ClientIDRef, - Selector: mg.Spec.ForProvider.CognitoIdentityProviders[i3].ClientIDSelector, - To: reference.To{ - List: &v1beta1.UserPoolClientList{}, - Managed: &v1beta1.UserPoolClient{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CognitoIdentityProviders[i3].ClientID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CognitoIdentityProviders[i3].ClientIDRef, + Selector: mg.Spec.ForProvider.CognitoIdentityProviders[i3].ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CognitoIdentityProviders[i3].ClientID") } @@ -116,16 +172,26 @@ func (mg *Pool) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.CognitoIdentityProviders[i3].ClientIDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SAMLProviderArns), - Extract: common.ARNExtractor(), - References: mg.Spec.ForProvider.SAMLProviderArnsRefs, - Selector: mg.Spec.ForProvider.SAMLProviderArnsSelector, - To: reference.To{ - List: &v1beta11.SAMLProviderList{}, - Managed: &v1beta11.SAMLProvider{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "SAMLProvider", + "SAMLProviderList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SAMLProviderArns), + Extract: common.ARNExtractor(), + References: mg.Spec.ForProvider.SAMLProviderArnsRefs, + Selector: mg.Spec.ForProvider.SAMLProviderArnsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SAMLProviderArns") } @@ -133,16 +199,26 @@ func (mg *Pool) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.SAMLProviderArnsRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.InitProvider.CognitoIdentityProviders); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CognitoIdentityProviders[i3].ClientID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CognitoIdentityProviders[i3].ClientIDRef, - Selector: mg.Spec.InitProvider.CognitoIdentityProviders[i3].ClientIDSelector, - To: reference.To{ - List: &v1beta1.UserPoolClientList{}, - Managed: &v1beta1.UserPoolClient{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CognitoIdentityProviders[i3].ClientID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CognitoIdentityProviders[i3].ClientIDRef, + Selector: mg.Spec.InitProvider.CognitoIdentityProviders[i3].ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CognitoIdentityProviders[i3].ClientID") } @@ -150,16 +226,26 @@ func (mg *Pool) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.InitProvider.CognitoIdentityProviders[i3].ClientIDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SAMLProviderArns), - Extract: common.ARNExtractor(), - References: mg.Spec.InitProvider.SAMLProviderArnsRefs, - Selector: mg.Spec.InitProvider.SAMLProviderArnsSelector, - To: reference.To{ - List: &v1beta11.SAMLProviderList{}, - Managed: &v1beta11.SAMLProvider{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "SAMLProvider", + "SAMLProviderList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SAMLProviderArns), + Extract: common.ARNExtractor(), + References: mg.Spec.InitProvider.SAMLProviderArnsRefs, + Selector: mg.Spec.InitProvider.SAMLProviderArnsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SAMLProviderArns") } @@ -171,21 +257,33 @@ func (mg *Pool) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this PoolRolesAttachment. func (mg *PoolRolesAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cognitoidentity.aws.upbound.io", + + "v1beta1", + "Pool", + + "PoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IdentityPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IdentityPoolIDRef, - Selector: mg.Spec.ForProvider.IdentityPoolIDSelector, - To: reference.To{ - List: &PoolList{}, - Managed: &Pool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IdentityPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IdentityPoolIDRef, + Selector: mg.Spec.ForProvider.IdentityPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IdentityPoolID") } @@ -194,16 +292,27 @@ func (mg *PoolRolesAttachment) ResolveReferences(ctx context.Context, c client.R for i3 := 0; i3 < len(mg.Spec.ForProvider.RoleMapping); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.RoleMapping[i3].MappingRule); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleMapping[i3].MappingRule[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RoleMapping[i3].MappingRule[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.RoleMapping[i3].MappingRule[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleMapping[i3].MappingRule[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RoleMapping[i3].MappingRule[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.RoleMapping[i3].MappingRule[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleMapping[i3].MappingRule[i4].RoleArn") } @@ -212,16 +321,26 @@ func (mg *PoolRolesAttachment) ResolveReferences(ctx context.Context, c client.R } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IdentityPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IdentityPoolIDRef, - Selector: mg.Spec.InitProvider.IdentityPoolIDSelector, - To: reference.To{ - List: &PoolList{}, - Managed: &Pool{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidentity.aws.upbound.io", + + "v1beta1", + "Pool", + + "PoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IdentityPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IdentityPoolIDRef, + Selector: mg.Spec.InitProvider.IdentityPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IdentityPoolID") } @@ -230,16 +349,27 @@ func (mg *PoolRolesAttachment) ResolveReferences(ctx context.Context, c client.R for i3 := 0; i3 < len(mg.Spec.InitProvider.RoleMapping); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.RoleMapping[i3].MappingRule); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleMapping[i3].MappingRule[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RoleMapping[i3].MappingRule[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.RoleMapping[i3].MappingRule[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleMapping[i3].MappingRule[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RoleMapping[i3].MappingRule[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.RoleMapping[i3].MappingRule[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleMapping[i3].MappingRule[i4].RoleArn") } diff --git a/apis/cognitoidp/v1beta1/zz_generated.resolvers.go b/apis/cognitoidp/v1beta1/zz_generated.resolvers.go index 6fbe40ac59..6950f2e4c6 100644 --- a/apis/cognitoidp/v1beta1/zz_generated.resolvers.go +++ b/apis/cognitoidp/v1beta1/zz_generated.resolvers.go @@ -10,48 +10,70 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta14 "github.com/upbound/provider-aws/apis/acm/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/lambda/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/pinpoint/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this IdentityProvider. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this IdentityProvider. func (mg *IdentityProvider) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } mg.Spec.ForProvider.UserPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolID") } @@ -63,37 +85,60 @@ func (mg *IdentityProvider) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this ResourceServer. func (mg *ResourceServer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } mg.Spec.ForProvider.UserPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolID") } @@ -105,37 +150,60 @@ func (mg *ResourceServer) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this RiskConfiguration. func (mg *RiskConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } mg.Spec.ForProvider.UserPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolID") } @@ -147,21 +215,34 @@ func (mg *RiskConfiguration) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this User. func (mg *User) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } @@ -173,69 +254,112 @@ func (mg *User) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this UserGroup. func (mg *UserGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } mg.Spec.ForProvider.UserPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } mg.Spec.InitProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolID") } @@ -247,101 +371,162 @@ func (mg *UserGroup) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this UserInGroup. func (mg *UserInGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserGroup", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GroupName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.GroupNameRef, - Selector: mg.Spec.ForProvider.GroupNameSelector, - To: reference.To{ - List: &UserGroupList{}, - Managed: &UserGroup{}, - }, - }) + "UserGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GroupName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.GroupNameRef, + Selector: mg.Spec.ForProvider.GroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GroupName") } mg.Spec.ForProvider.GroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } mg.Spec.ForProvider.UserPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Username), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UsernameRef, - Selector: mg.Spec.ForProvider.UsernameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Username), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UsernameRef, + Selector: mg.Spec.ForProvider.UsernameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Username") } mg.Spec.ForProvider.Username = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UsernameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserGroup", + + "UserGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GroupName), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.GroupNameRef, - Selector: mg.Spec.InitProvider.GroupNameSelector, - To: reference.To{ - List: &UserGroupList{}, - Managed: &UserGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GroupName), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.GroupNameRef, + Selector: mg.Spec.InitProvider.GroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GroupName") } mg.Spec.InitProvider.GroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolID") } mg.Spec.InitProvider.UserPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.UserPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Username), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UsernameRef, - Selector: mg.Spec.InitProvider.UsernameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Username), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UsernameRef, + Selector: mg.Spec.InitProvider.UsernameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Username") } @@ -353,22 +538,35 @@ func (mg *UserInGroup) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this UserPool. func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].CreateAuthChallenge), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].CreateAuthChallengeRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].CreateAuthChallengeSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].CreateAuthChallenge), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].CreateAuthChallengeRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].CreateAuthChallengeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].CreateAuthChallenge") } @@ -378,16 +576,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LambdaConfig[i3].CustomEmailSender); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArnRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArnSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArnRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArn") } @@ -397,16 +605,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].CustomMessage), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].CustomMessageRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].CustomMessageSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].CustomMessage), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].CustomMessageRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].CustomMessageSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].CustomMessage") } @@ -416,16 +634,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LambdaConfig[i3].CustomSMSSender); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArnRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArnSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArnRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArn") } @@ -435,16 +663,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].DefineAuthChallenge), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].DefineAuthChallengeRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].DefineAuthChallengeSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].DefineAuthChallenge), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].DefineAuthChallengeRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].DefineAuthChallengeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].DefineAuthChallenge") } @@ -453,16 +691,25 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].KMSKeyIDRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].KMSKeyIDRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].KMSKeyID") } @@ -471,16 +718,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PostAuthentication), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].PostAuthenticationRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].PostAuthenticationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PostAuthentication), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].PostAuthenticationRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].PostAuthenticationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].PostAuthentication") } @@ -489,16 +746,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PostConfirmation), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].PostConfirmationRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].PostConfirmationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PostConfirmation), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].PostConfirmationRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].PostConfirmationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].PostConfirmation") } @@ -507,16 +774,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PreAuthentication), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].PreAuthenticationRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].PreAuthenticationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PreAuthentication), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].PreAuthenticationRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].PreAuthenticationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].PreAuthentication") } @@ -525,16 +802,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PreSignUp), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].PreSignUpRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].PreSignUpSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PreSignUp), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].PreSignUpRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].PreSignUpSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].PreSignUp") } @@ -543,34 +830,54 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGeneration), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGenerationRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGenerationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) - if err != nil { - return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGeneration") - } - mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGeneration = reference.ToPtrValue(rsp.ResolvedValue) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGeneration), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGenerationRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGenerationSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGeneration") + } + mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGeneration = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LambdaConfig[i3].PreTokenGenerationRef = rsp.ResolvedReference } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].UserMigration), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].UserMigrationRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].UserMigrationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].UserMigration), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].UserMigrationRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].UserMigrationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].UserMigration") } @@ -579,16 +886,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].VerifyAuthChallengeResponse), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaConfig[i3].VerifyAuthChallengeResponseRef, - Selector: mg.Spec.ForProvider.LambdaConfig[i3].VerifyAuthChallengeResponseSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaConfig[i3].VerifyAuthChallengeResponse), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaConfig[i3].VerifyAuthChallengeResponseRef, + Selector: mg.Spec.ForProvider.LambdaConfig[i3].VerifyAuthChallengeResponseSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaConfig[i3].VerifyAuthChallengeResponse") } @@ -597,16 +914,27 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.SMSConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SMSConfiguration[i3].SnsCallerArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.SMSConfiguration[i3].SnsCallerArnRef, - Selector: mg.Spec.ForProvider.SMSConfiguration[i3].SnsCallerArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SMSConfiguration[i3].SnsCallerArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.SMSConfiguration[i3].SnsCallerArnRef, + Selector: mg.Spec.ForProvider.SMSConfiguration[i3].SnsCallerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SMSConfiguration[i3].SnsCallerArn") } @@ -615,16 +943,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].CreateAuthChallenge), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].CreateAuthChallengeRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].CreateAuthChallengeSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].CreateAuthChallenge), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].CreateAuthChallengeRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].CreateAuthChallengeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].CreateAuthChallenge") } @@ -634,16 +972,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LambdaConfig[i3].CustomEmailSender); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArnRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArnSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArnRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].CustomEmailSender[i4].LambdaArn") } @@ -653,16 +1001,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].CustomMessage), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].CustomMessageRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].CustomMessageSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].CustomMessage), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].CustomMessageRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].CustomMessageSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].CustomMessage") } @@ -672,16 +1030,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LambdaConfig[i3].CustomSMSSender); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArnRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArnSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArnRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].CustomSMSSender[i4].LambdaArn") } @@ -691,16 +1059,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].DefineAuthChallenge), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].DefineAuthChallengeRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].DefineAuthChallengeSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].DefineAuthChallenge), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].DefineAuthChallengeRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].DefineAuthChallengeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].DefineAuthChallenge") } @@ -709,16 +1087,25 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].KMSKeyIDRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].KMSKeyIDRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].KMSKeyID") } @@ -727,16 +1114,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PostAuthentication), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].PostAuthenticationRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].PostAuthenticationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PostAuthentication), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].PostAuthenticationRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].PostAuthenticationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].PostAuthentication") } @@ -745,16 +1142,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PostConfirmation), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].PostConfirmationRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].PostConfirmationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PostConfirmation), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].PostConfirmationRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].PostConfirmationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].PostConfirmation") } @@ -763,16 +1170,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PreAuthentication), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].PreAuthenticationRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].PreAuthenticationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PreAuthentication), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].PreAuthenticationRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].PreAuthenticationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].PreAuthentication") } @@ -781,16 +1198,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PreSignUp), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].PreSignUpRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].PreSignUpSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PreSignUp), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].PreSignUpRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].PreSignUpSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].PreSignUp") } @@ -799,16 +1226,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PreTokenGeneration), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].PreTokenGenerationRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].PreTokenGenerationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].PreTokenGeneration), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].PreTokenGenerationRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].PreTokenGenerationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].PreTokenGeneration") } @@ -817,16 +1254,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].UserMigration), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].UserMigrationRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].UserMigrationSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].UserMigration), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].UserMigrationRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].UserMigrationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].UserMigration") } @@ -835,16 +1282,26 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.LambdaConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].VerifyAuthChallengeResponse), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaConfig[i3].VerifyAuthChallengeResponseRef, - Selector: mg.Spec.InitProvider.LambdaConfig[i3].VerifyAuthChallengeResponseSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaConfig[i3].VerifyAuthChallengeResponse), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaConfig[i3].VerifyAuthChallengeResponseRef, + Selector: mg.Spec.InitProvider.LambdaConfig[i3].VerifyAuthChallengeResponseSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaConfig[i3].VerifyAuthChallengeResponse") } @@ -853,16 +1310,27 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.SMSConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SMSConfiguration[i3].SnsCallerArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.SMSConfiguration[i3].SnsCallerArnRef, - Selector: mg.Spec.InitProvider.SMSConfiguration[i3].SnsCallerArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SMSConfiguration[i3].SnsCallerArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.SMSConfiguration[i3].SnsCallerArnRef, + Selector: mg.Spec.InitProvider.SMSConfiguration[i3].SnsCallerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SMSConfiguration[i3].SnsCallerArn") } @@ -876,22 +1344,35 @@ func (mg *UserPool) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this UserPoolClient. func (mg *UserPoolClient) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.AnalyticsConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AnalyticsConfiguration[i3].ApplicationID), - Extract: resource.ExtractParamPath("application_id", true), - Reference: mg.Spec.ForProvider.AnalyticsConfiguration[i3].ApplicationIDRef, - Selector: mg.Spec.ForProvider.AnalyticsConfiguration[i3].ApplicationIDSelector, - To: reference.To{ - List: &v1beta13.AppList{}, - Managed: &v1beta13.App{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("pinpoint.aws.upbound.io", + + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AnalyticsConfiguration[i3].ApplicationID), + Extract: resource.ExtractParamPath("application_id", true), + Reference: mg.Spec.ForProvider.AnalyticsConfiguration[i3].ApplicationIDRef, + Selector: mg.Spec.ForProvider.AnalyticsConfiguration[i3].ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AnalyticsConfiguration[i3].ApplicationID") } @@ -900,16 +1381,27 @@ func (mg *UserPoolClient) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.AnalyticsConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AnalyticsConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.AnalyticsConfiguration[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.AnalyticsConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AnalyticsConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.AnalyticsConfiguration[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.AnalyticsConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AnalyticsConfiguration[i3].RoleArn") } @@ -917,16 +1409,27 @@ func (mg *UserPoolClient) ResolveReferences(ctx context.Context, c client.Reader mg.Spec.ForProvider.AnalyticsConfiguration[i3].RoleArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } @@ -934,16 +1437,26 @@ func (mg *UserPoolClient) ResolveReferences(ctx context.Context, c client.Reader mg.Spec.ForProvider.UserPoolIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.AnalyticsConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AnalyticsConfiguration[i3].ApplicationID), - Extract: resource.ExtractParamPath("application_id", true), - Reference: mg.Spec.InitProvider.AnalyticsConfiguration[i3].ApplicationIDRef, - Selector: mg.Spec.InitProvider.AnalyticsConfiguration[i3].ApplicationIDSelector, - To: reference.To{ - List: &v1beta13.AppList{}, - Managed: &v1beta13.App{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("pinpoint.aws.upbound.io", + + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AnalyticsConfiguration[i3].ApplicationID), + Extract: resource.ExtractParamPath("application_id", true), + Reference: mg.Spec.InitProvider.AnalyticsConfiguration[i3].ApplicationIDRef, + Selector: mg.Spec.InitProvider.AnalyticsConfiguration[i3].ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AnalyticsConfiguration[i3].ApplicationID") } @@ -952,16 +1465,27 @@ func (mg *UserPoolClient) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.AnalyticsConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AnalyticsConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.AnalyticsConfiguration[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.AnalyticsConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AnalyticsConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.AnalyticsConfiguration[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.AnalyticsConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AnalyticsConfiguration[i3].RoleArn") } @@ -969,16 +1493,27 @@ func (mg *UserPoolClient) ResolveReferences(ctx context.Context, c client.Reader mg.Spec.InitProvider.AnalyticsConfiguration[i3].RoleArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolID") } @@ -990,69 +1525,110 @@ func (mg *UserPoolClient) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this UserPoolDomain. func (mg *UserPoolDomain) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CertificateArnRef, - Selector: mg.Spec.ForProvider.CertificateArnSelector, - To: reference.To{ - List: &v1beta14.CertificateList{}, - Managed: &v1beta14.Certificate{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CertificateArnRef, + Selector: mg.Spec.ForProvider.CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CertificateArn") } mg.Spec.ForProvider.CertificateArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CertificateArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } mg.Spec.ForProvider.UserPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.CertificateArnRef, - Selector: mg.Spec.InitProvider.CertificateArnSelector, - To: reference.To{ - List: &v1beta14.CertificateList{}, - Managed: &v1beta14.Certificate{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.CertificateArnRef, + Selector: mg.Spec.InitProvider.CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CertificateArn") } mg.Spec.InitProvider.CertificateArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CertificateArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolID") } @@ -1064,69 +1640,110 @@ func (mg *UserPoolDomain) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this UserPoolUICustomization. func (mg *UserPoolUICustomization) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClientIDRef, - Selector: mg.Spec.ForProvider.ClientIDSelector, - To: reference.To{ - List: &UserPoolClientList{}, - Managed: &UserPoolClient{}, - }, - }) + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClientIDRef, + Selector: mg.Spec.ForProvider.ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClientID") } mg.Spec.ForProvider.ClientID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClientIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserPoolIDRef, - Selector: mg.Spec.ForProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserPoolIDRef, + Selector: mg.Spec.ForProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserPoolID") } mg.Spec.ForProvider.UserPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClientIDRef, - Selector: mg.Spec.InitProvider.ClientIDSelector, - To: reference.To{ - List: &UserPoolClientList{}, - Managed: &UserPoolClient{}, - }, - }) + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClientIDRef, + Selector: mg.Spec.InitProvider.ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClientID") } mg.Spec.InitProvider.ClientID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClientIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserPoolIDRef, - Selector: mg.Spec.InitProvider.UserPoolIDSelector, - To: reference.To{ - List: &UserPoolList{}, - Managed: &UserPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserPoolID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserPoolIDRef, + Selector: mg.Spec.InitProvider.UserPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserPoolID") } diff --git a/apis/configservice/v1beta1/zz_generated.resolvers.go b/apis/configservice/v1beta1/zz_generated.resolvers.go index db9a3a2b60..c782a8e17d 100644 --- a/apis/configservice/v1beta1/zz_generated.resolvers.go +++ b/apis/configservice/v1beta1/zz_generated.resolvers.go @@ -10,31 +10,45 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ConfigRule. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ConfigRule. func (mg *ConfigRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Source); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Source[i3].SourceIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Source[i3].SourceIdentifierRef, - Selector: mg.Spec.ForProvider.Source[i3].SourceIdentifierSelector, - To: reference.To{ - List: &v1beta1.FunctionList{}, - Managed: &v1beta1.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Source[i3].SourceIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Source[i3].SourceIdentifierRef, + Selector: mg.Spec.ForProvider.Source[i3].SourceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Source[i3].SourceIdentifier") } @@ -43,16 +57,26 @@ func (mg *ConfigRule) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.InitProvider.Source); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Source[i3].SourceIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Source[i3].SourceIdentifierRef, - Selector: mg.Spec.InitProvider.Source[i3].SourceIdentifierSelector, - To: reference.To{ - List: &v1beta1.FunctionList{}, - Managed: &v1beta1.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Source[i3].SourceIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Source[i3].SourceIdentifierRef, + Selector: mg.Spec.InitProvider.Source[i3].SourceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Source[i3].SourceIdentifier") } @@ -66,22 +90,36 @@ func (mg *ConfigRule) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this ConfigurationAggregator. func (mg *ConfigurationAggregator) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.OrganizationAggregationSource); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OrganizationAggregationSource[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OrganizationAggregationSource[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.OrganizationAggregationSource[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OrganizationAggregationSource[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OrganizationAggregationSource[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.OrganizationAggregationSource[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OrganizationAggregationSource[i3].RoleArn") } @@ -90,16 +128,27 @@ func (mg *ConfigurationAggregator) ResolveReferences(ctx context.Context, c clie } for i3 := 0; i3 < len(mg.Spec.InitProvider.OrganizationAggregationSource); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OrganizationAggregationSource[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OrganizationAggregationSource[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.OrganizationAggregationSource[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OrganizationAggregationSource[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OrganizationAggregationSource[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.OrganizationAggregationSource[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OrganizationAggregationSource[i3].RoleArn") } @@ -113,37 +162,60 @@ func (mg *ConfigurationAggregator) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this ConfigurationRecorder. func (mg *ConfigurationRecorder) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -155,37 +227,58 @@ func (mg *ConfigurationRecorder) ResolveReferences(ctx context.Context, c client // ResolveReferences of this DeliveryChannel. func (mg *DeliveryChannel) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3BucketName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.S3BucketNameRef, - Selector: mg.Spec.ForProvider.S3BucketNameSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3BucketName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.S3BucketNameRef, + Selector: mg.Spec.ForProvider.S3BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3BucketName") } mg.Spec.ForProvider.S3BucketName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.S3BucketNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3BucketName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.S3BucketNameRef, - Selector: mg.Spec.InitProvider.S3BucketNameSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3BucketName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.S3BucketNameRef, + Selector: mg.Spec.InitProvider.S3BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.S3BucketName") } diff --git a/apis/connect/v1beta1/zz_generated.resolvers.go b/apis/connect/v1beta1/zz_generated.resolvers.go index 80cad21166..3e0b5cee68 100644 --- a/apis/connect/v1beta1/zz_generated.resolvers.go +++ b/apis/connect/v1beta1/zz_generated.resolvers.go @@ -10,33 +10,42 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/ds/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/firehose/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta16 "github.com/upbound/provider-aws/apis/lambda/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/lexmodels/v1beta1" - v1beta15 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this BotAssociation. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this BotAssociation. func (mg *BotAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } @@ -44,16 +53,26 @@ func (mg *BotAssociation) ResolveReferences(ctx context.Context, c client.Reader mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.LexBot); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LexBot[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LexBot[i3].NameRef, - Selector: mg.Spec.ForProvider.LexBot[i3].NameSelector, - To: reference.To{ - List: &v1beta1.BotList{}, - Managed: &v1beta1.Bot{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lexmodels.aws.upbound.io", + + "v1beta1", + + "Bot", + "BotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LexBot[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LexBot[i3].NameRef, + Selector: mg.Spec.ForProvider.LexBot[i3].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LexBot[i3].Name") } @@ -62,16 +81,26 @@ func (mg *BotAssociation) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.LexBot); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LexBot[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LexBot[i3].NameRef, - Selector: mg.Spec.InitProvider.LexBot[i3].NameSelector, - To: reference.To{ - List: &v1beta1.BotList{}, - Managed: &v1beta1.Bot{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lexmodels.aws.upbound.io", + + "v1beta1", + + "Bot", + "BotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LexBot[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LexBot[i3].NameRef, + Selector: mg.Spec.InitProvider.LexBot[i3].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LexBot[i3].Name") } @@ -85,37 +114,58 @@ func (mg *BotAssociation) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this ContactFlow. func (mg *ContactFlow) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -127,37 +177,58 @@ func (mg *ContactFlow) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this ContactFlowModule. func (mg *ContactFlowModule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -169,37 +240,58 @@ func (mg *ContactFlowModule) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this HoursOfOperation. func (mg *HoursOfOperation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -211,37 +303,58 @@ func (mg *HoursOfOperation) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this Instance. func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DirectoryIDRef, - Selector: mg.Spec.ForProvider.DirectoryIDSelector, - To: reference.To{ - List: &v1beta11.DirectoryList{}, - Managed: &v1beta11.Directory{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DirectoryIDRef, + Selector: mg.Spec.ForProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DirectoryID") } mg.Spec.ForProvider.DirectoryID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DirectoryIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DirectoryIDRef, - Selector: mg.Spec.InitProvider.DirectoryIDSelector, - To: reference.To{ - List: &v1beta11.DirectoryList{}, - Managed: &v1beta11.Directory{}, - }, - }) + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DirectoryIDRef, + Selector: mg.Spec.InitProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DirectoryID") } @@ -253,21 +366,33 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this InstanceStorageConfig. func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } @@ -276,16 +401,26 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.StorageConfig[i3].KinesisFirehoseConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArnRef, - Selector: mg.Spec.ForProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArnSelector, - To: reference.To{ - List: &v1beta12.DeliveryStreamList{}, - Managed: &v1beta12.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArnRef, + Selector: mg.Spec.ForProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArn") } @@ -296,16 +431,26 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.StorageConfig[i3].KinesisStreamConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArnRef, - Selector: mg.Spec.ForProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArnSelector, - To: reference.To{ - List: &v1beta13.StreamList{}, - Managed: &v1beta13.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArnRef, + Selector: mg.Spec.ForProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArn") } @@ -317,16 +462,25 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyIDRef, - Selector: mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyIDSelector, - To: reference.To{ - List: &v1beta14.KeyList{}, - Managed: &v1beta14.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyIDRef, + Selector: mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyID") } @@ -338,16 +492,26 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.StorageConfig[i3].S3Config); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].BucketName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].BucketNameRef, - Selector: mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].BucketNameSelector, - To: reference.To{ - List: &v1beta15.BucketList{}, - Managed: &v1beta15.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].BucketName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].BucketNameRef, + Selector: mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].BucketName") } @@ -359,16 +523,25 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.StorageConfig[i3].S3Config); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyIDRef, - Selector: mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyIDSelector, - To: reference.To{ - List: &v1beta14.KeyList{}, - Managed: &v1beta14.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyIDRef, + Selector: mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyID") } @@ -378,16 +551,26 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -396,16 +579,26 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.StorageConfig[i3].KinesisFirehoseConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArnRef, - Selector: mg.Spec.InitProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArnSelector, - To: reference.To{ - List: &v1beta12.DeliveryStreamList{}, - Managed: &v1beta12.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArnRef, + Selector: mg.Spec.InitProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageConfig[i3].KinesisFirehoseConfig[i4].FirehoseArn") } @@ -416,16 +609,26 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.StorageConfig[i3].KinesisStreamConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArnRef, - Selector: mg.Spec.InitProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArnSelector, - To: reference.To{ - List: &v1beta13.StreamList{}, - Managed: &v1beta13.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArnRef, + Selector: mg.Spec.InitProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageConfig[i3].KinesisStreamConfig[i4].StreamArn") } @@ -437,16 +640,25 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyIDRef, - Selector: mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyIDSelector, - To: reference.To{ - List: &v1beta14.KeyList{}, - Managed: &v1beta14.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyIDRef, + Selector: mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageConfig[i3].KinesisVideoStreamConfig[i4].EncryptionConfig[i5].KeyID") } @@ -458,16 +670,26 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.StorageConfig[i3].S3Config); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].BucketName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].BucketNameRef, - Selector: mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].BucketNameSelector, - To: reference.To{ - List: &v1beta15.BucketList{}, - Managed: &v1beta15.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].BucketName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].BucketNameRef, + Selector: mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].BucketName") } @@ -479,16 +701,25 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.StorageConfig[i3].S3Config); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyIDRef, - Selector: mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyIDSelector, - To: reference.To{ - List: &v1beta14.KeyList{}, - Managed: &v1beta14.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyIDRef, + Selector: mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageConfig[i3].S3Config[i4].EncryptionConfig[i5].KeyID") } @@ -504,37 +735,58 @@ func (mg *InstanceStorageConfig) ResolveReferences(ctx context.Context, c client // ResolveReferences of this LambdaFunctionAssociation. func (mg *LambdaFunctionAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.FunctionArnRef, - Selector: mg.Spec.ForProvider.FunctionArnSelector, - To: reference.To{ - List: &v1beta16.FunctionList{}, - Managed: &v1beta16.Function{}, - }, - }) + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.FunctionArnRef, + Selector: mg.Spec.ForProvider.FunctionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FunctionArn") } mg.Spec.ForProvider.FunctionArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FunctionArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } @@ -546,37 +798,58 @@ func (mg *LambdaFunctionAssociation) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this PhoneNumber. func (mg *PhoneNumber) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TargetArnRef, - Selector: mg.Spec.ForProvider.TargetArnSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TargetArnRef, + Selector: mg.Spec.ForProvider.TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetArn") } mg.Spec.ForProvider.TargetArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TargetArnRef, - Selector: mg.Spec.InitProvider.TargetArnSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TargetArnRef, + Selector: mg.Spec.InitProvider.TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetArn") } @@ -588,69 +861,108 @@ func (mg *PhoneNumber) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Queue. func (mg *Queue) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "HoursOfOperation", + + "HoursOfOperationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HoursOfOperationID), - Extract: resource.ExtractParamPath("hours_of_operation_id", true), - Reference: mg.Spec.ForProvider.HoursOfOperationIDRef, - Selector: mg.Spec.ForProvider.HoursOfOperationIDSelector, - To: reference.To{ - List: &HoursOfOperationList{}, - Managed: &HoursOfOperation{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HoursOfOperationID), + Extract: resource.ExtractParamPath("hours_of_operation_id", true), + Reference: mg.Spec.ForProvider.HoursOfOperationIDRef, + Selector: mg.Spec.ForProvider.HoursOfOperationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HoursOfOperationID") } mg.Spec.ForProvider.HoursOfOperationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HoursOfOperationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HoursOfOperationID), - Extract: resource.ExtractParamPath("hours_of_operation_id", true), - Reference: mg.Spec.InitProvider.HoursOfOperationIDRef, - Selector: mg.Spec.InitProvider.HoursOfOperationIDSelector, - To: reference.To{ - List: &HoursOfOperationList{}, - Managed: &HoursOfOperation{}, - }, - }) + "v1beta1", + + "HoursOfOperation", + + "HoursOfOperationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HoursOfOperationID), + Extract: resource.ExtractParamPath("hours_of_operation_id", true), + Reference: mg.Spec.InitProvider.HoursOfOperationIDRef, + Selector: mg.Spec.InitProvider.HoursOfOperationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HoursOfOperationID") } mg.Spec.InitProvider.HoursOfOperationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.HoursOfOperationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -662,37 +974,58 @@ func (mg *Queue) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this QuickConnect. func (mg *QuickConnect) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -704,69 +1037,108 @@ func (mg *QuickConnect) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this RoutingProfile. func (mg *RoutingProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultOutboundQueueID), - Extract: resource.ExtractParamPath("queue_id", true), - Reference: mg.Spec.ForProvider.DefaultOutboundQueueIDRef, - Selector: mg.Spec.ForProvider.DefaultOutboundQueueIDSelector, - To: reference.To{ - List: &QueueList{}, - Managed: &Queue{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultOutboundQueueID), + Extract: resource.ExtractParamPath("queue_id", true), + Reference: mg.Spec.ForProvider.DefaultOutboundQueueIDRef, + Selector: mg.Spec.ForProvider.DefaultOutboundQueueIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultOutboundQueueID") } mg.Spec.ForProvider.DefaultOutboundQueueID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DefaultOutboundQueueIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultOutboundQueueID), - Extract: resource.ExtractParamPath("queue_id", true), - Reference: mg.Spec.InitProvider.DefaultOutboundQueueIDRef, - Selector: mg.Spec.InitProvider.DefaultOutboundQueueIDSelector, - To: reference.To{ - List: &QueueList{}, - Managed: &Queue{}, - }, - }) + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultOutboundQueueID), + Extract: resource.ExtractParamPath("queue_id", true), + Reference: mg.Spec.InitProvider.DefaultOutboundQueueIDRef, + Selector: mg.Spec.InitProvider.DefaultOutboundQueueIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultOutboundQueueID") } mg.Spec.InitProvider.DefaultOutboundQueueID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DefaultOutboundQueueIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -778,37 +1150,58 @@ func (mg *RoutingProfile) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this SecurityProfile. func (mg *SecurityProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -820,69 +1213,108 @@ func (mg *SecurityProfile) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this User. func (mg *User) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoutingProfileID), - Extract: resource.ExtractParamPath("routing_profile_id", true), - Reference: mg.Spec.ForProvider.RoutingProfileIDRef, - Selector: mg.Spec.ForProvider.RoutingProfileIDSelector, - To: reference.To{ - List: &RoutingProfileList{}, - Managed: &RoutingProfile{}, - }, - }) + "v1beta1", + + "RoutingProfile", + + "RoutingProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoutingProfileID), + Extract: resource.ExtractParamPath("routing_profile_id", true), + Reference: mg.Spec.ForProvider.RoutingProfileIDRef, + Selector: mg.Spec.ForProvider.RoutingProfileIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoutingProfileID") } mg.Spec.ForProvider.RoutingProfileID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoutingProfileIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } mg.Spec.InitProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "RoutingProfile", + + "RoutingProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoutingProfileID), - Extract: resource.ExtractParamPath("routing_profile_id", true), - Reference: mg.Spec.InitProvider.RoutingProfileIDRef, - Selector: mg.Spec.InitProvider.RoutingProfileIDSelector, - To: reference.To{ - List: &RoutingProfileList{}, - Managed: &RoutingProfile{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoutingProfileID), + Extract: resource.ExtractParamPath("routing_profile_id", true), + Reference: mg.Spec.InitProvider.RoutingProfileIDRef, + Selector: mg.Spec.InitProvider.RoutingProfileIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoutingProfileID") } @@ -894,37 +1326,58 @@ func (mg *User) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this UserHierarchyStructure. func (mg *UserHierarchyStructure) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -936,37 +1389,58 @@ func (mg *UserHierarchyStructure) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this Vocabulary. func (mg *Vocabulary) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("connect.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } diff --git a/apis/cur/v1beta1/zz_generated.resolvers.go b/apis/cur/v1beta1/zz_generated.resolvers.go index 913df9531b..c81049cf6b 100644 --- a/apis/cur/v1beta1/zz_generated.resolvers.go +++ b/apis/cur/v1beta1/zz_generated.resolvers.go @@ -9,43 +9,67 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ReportDefinition. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ReportDefinition. func (mg *ReportDefinition) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.S3BucketRef, - Selector: mg.Spec.ForProvider.S3BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.S3BucketRef, + Selector: mg.Spec.ForProvider.S3BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3Bucket") } mg.Spec.ForProvider.S3Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.S3BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.S3BucketRef, - Selector: mg.Spec.InitProvider.S3BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.S3BucketRef, + Selector: mg.Spec.InitProvider.S3BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.S3Bucket") } diff --git a/apis/dataexchange/v1beta1/zz_generated.resolvers.go b/apis/dataexchange/v1beta1/zz_generated.resolvers.go index 587988a7af..9f851dda5e 100644 --- a/apis/dataexchange/v1beta1/zz_generated.resolvers.go +++ b/apis/dataexchange/v1beta1/zz_generated.resolvers.go @@ -8,44 +8,70 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Revision. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Revision. func (mg *Revision) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("dataexchange.aws.upbound.io", + + "v1beta1", + + "DataSet", + + "DataSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataSetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DataSetIDRef, - Selector: mg.Spec.ForProvider.DataSetIDSelector, - To: reference.To{ - List: &DataSetList{}, - Managed: &DataSet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataSetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DataSetIDRef, + Selector: mg.Spec.ForProvider.DataSetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DataSetID") } mg.Spec.ForProvider.DataSetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DataSetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("dataexchange.aws.upbound.io", + + "v1beta1", + + "DataSet", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataSetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DataSetIDRef, - Selector: mg.Spec.InitProvider.DataSetIDSelector, - To: reference.To{ - List: &DataSetList{}, - Managed: &DataSet{}, - }, - }) + "DataSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataSetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DataSetIDRef, + Selector: mg.Spec.InitProvider.DataSetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DataSetID") } diff --git a/apis/datasync/v1beta1/zz_generated.resolvers.go b/apis/datasync/v1beta1/zz_generated.resolvers.go index 8b363c7212..7524135405 100644 --- a/apis/datasync/v1beta1/zz_generated.resolvers.go +++ b/apis/datasync/v1beta1/zz_generated.resolvers.go @@ -10,30 +10,43 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this LocationS3. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this LocationS3. func (mg *LocationS3) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.S3BucketArnRef, - Selector: mg.Spec.ForProvider.S3BucketArnSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.S3BucketArnRef, + Selector: mg.Spec.ForProvider.S3BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3BucketArn") } @@ -41,16 +54,27 @@ func (mg *LocationS3) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.ForProvider.S3BucketArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.S3Config); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Config[i3].BucketAccessRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.S3Config[i3].BucketAccessRoleArnRef, - Selector: mg.Spec.ForProvider.S3Config[i3].BucketAccessRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Config[i3].BucketAccessRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.S3Config[i3].BucketAccessRoleArnRef, + Selector: mg.Spec.ForProvider.S3Config[i3].BucketAccessRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3Config[i3].BucketAccessRoleArn") } @@ -58,16 +82,26 @@ func (mg *LocationS3) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.ForProvider.S3Config[i3].BucketAccessRoleArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.S3BucketArnRef, - Selector: mg.Spec.InitProvider.S3BucketArnSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.S3BucketArnRef, + Selector: mg.Spec.InitProvider.S3BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.S3BucketArn") } @@ -75,16 +109,27 @@ func (mg *LocationS3) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.InitProvider.S3BucketArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.S3Config); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Config[i3].BucketAccessRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.S3Config[i3].BucketAccessRoleArnRef, - Selector: mg.Spec.InitProvider.S3Config[i3].BucketAccessRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Config[i3].BucketAccessRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.S3Config[i3].BucketAccessRoleArnRef, + Selector: mg.Spec.InitProvider.S3Config[i3].BucketAccessRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.S3Config[i3].BucketAccessRoleArn") } @@ -98,101 +143,162 @@ func (mg *LocationS3) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Task. func (mg *Task) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchLogGroupArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.CloudwatchLogGroupArnRef, - Selector: mg.Spec.ForProvider.CloudwatchLogGroupArnSelector, - To: reference.To{ - List: &v1beta12.GroupList{}, - Managed: &v1beta12.Group{}, - }, - }) + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchLogGroupArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.CloudwatchLogGroupArnRef, + Selector: mg.Spec.ForProvider.CloudwatchLogGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CloudwatchLogGroupArn") } mg.Spec.ForProvider.CloudwatchLogGroupArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CloudwatchLogGroupArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("datasync.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationLocationArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DestinationLocationArnRef, - Selector: mg.Spec.ForProvider.DestinationLocationArnSelector, - To: reference.To{ - List: &LocationS3List{}, - Managed: &LocationS3{}, - }, - }) + "LocationS3", + + "LocationS3List", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationLocationArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DestinationLocationArnRef, + Selector: mg.Spec.ForProvider.DestinationLocationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DestinationLocationArn") } mg.Spec.ForProvider.DestinationLocationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DestinationLocationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("datasync.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceLocationArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SourceLocationArnRef, - Selector: mg.Spec.ForProvider.SourceLocationArnSelector, - To: reference.To{ - List: &LocationS3List{}, - Managed: &LocationS3{}, - }, - }) + "LocationS3", + + "LocationS3List", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceLocationArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SourceLocationArnRef, + Selector: mg.Spec.ForProvider.SourceLocationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceLocationArn") } mg.Spec.ForProvider.SourceLocationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceLocationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchLogGroupArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.CloudwatchLogGroupArnRef, - Selector: mg.Spec.InitProvider.CloudwatchLogGroupArnSelector, - To: reference.To{ - List: &v1beta12.GroupList{}, - Managed: &v1beta12.Group{}, - }, - }) + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchLogGroupArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.CloudwatchLogGroupArnRef, + Selector: mg.Spec.InitProvider.CloudwatchLogGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CloudwatchLogGroupArn") } mg.Spec.InitProvider.CloudwatchLogGroupArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CloudwatchLogGroupArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("datasync.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationLocationArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DestinationLocationArnRef, - Selector: mg.Spec.InitProvider.DestinationLocationArnSelector, - To: reference.To{ - List: &LocationS3List{}, - Managed: &LocationS3{}, - }, - }) + "LocationS3", + + "LocationS3List", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationLocationArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DestinationLocationArnRef, + Selector: mg.Spec.InitProvider.DestinationLocationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DestinationLocationArn") } mg.Spec.InitProvider.DestinationLocationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DestinationLocationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("datasync.aws.upbound.io", + + "v1beta1", + + "LocationS3", + + "LocationS3List", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceLocationArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SourceLocationArnRef, - Selector: mg.Spec.InitProvider.SourceLocationArnSelector, - To: reference.To{ - List: &LocationS3List{}, - Managed: &LocationS3{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceLocationArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SourceLocationArnRef, + Selector: mg.Spec.InitProvider.SourceLocationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceLocationArn") } diff --git a/apis/dax/v1beta1/zz_generated.resolvers.go b/apis/dax/v1beta1/zz_generated.resolvers.go index 049b8d28c5..85a1b87e52 100644 --- a/apis/dax/v1beta1/zz_generated.resolvers.go +++ b/apis/dax/v1beta1/zz_generated.resolvers.go @@ -9,78 +9,121 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Cluster. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMRoleArnRef, - Selector: mg.Spec.ForProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMRoleArnRef, + Selector: mg.Spec.ForProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoleArn") } mg.Spec.ForProvider.IAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMRoleArnRef, - Selector: mg.Spec.InitProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMRoleArnRef, + Selector: mg.Spec.InitProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoleArn") } mg.Spec.InitProvider.IAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } @@ -92,37 +135,58 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this SubnetGroup. func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/deploy/v1beta1/zz_generated.resolvers.go b/apis/deploy/v1beta1/zz_generated.resolvers.go index c42cef96ee..44f6b7a9d5 100644 --- a/apis/deploy/v1beta1/zz_generated.resolvers.go +++ b/apis/deploy/v1beta1/zz_generated.resolvers.go @@ -10,32 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ecs/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/elb/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this DeploymentGroup. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this DeploymentGroup. func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("deploy.aws.upbound.io", + + "v1beta1", + + "App", + "AppList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AppNameRef, - Selector: mg.Spec.ForProvider.AppNameSelector, - To: reference.To{ - List: &AppList{}, - Managed: &App{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AppNameRef, + Selector: mg.Spec.ForProvider.AppNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AppName") } @@ -43,16 +55,26 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade mg.Spec.ForProvider.AppNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.EcsService); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EcsService[i3].ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EcsService[i3].ClusterNameRef, - Selector: mg.Spec.ForProvider.EcsService[i3].ClusterNameSelector, - To: reference.To{ - List: &v1beta1.ClusterList{}, - Managed: &v1beta1.Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EcsService[i3].ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EcsService[i3].ClusterNameRef, + Selector: mg.Spec.ForProvider.EcsService[i3].ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EcsService[i3].ClusterName") } @@ -61,16 +83,26 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.ForProvider.EcsService); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EcsService[i3].ServiceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EcsService[i3].ServiceNameRef, - Selector: mg.Spec.ForProvider.EcsService[i3].ServiceNameSelector, - To: reference.To{ - List: &v1beta1.ServiceList{}, - Managed: &v1beta1.Service{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Service", + "ServiceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EcsService[i3].ServiceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EcsService[i3].ServiceNameRef, + Selector: mg.Spec.ForProvider.EcsService[i3].ServiceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EcsService[i3].ServiceName") } @@ -80,16 +112,25 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.ForProvider.LoadBalancerInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LoadBalancerInfo[i3].ELBInfo); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerInfo[i3].ELBInfo[i4].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoadBalancerInfo[i3].ELBInfo[i4].NameRef, - Selector: mg.Spec.ForProvider.LoadBalancerInfo[i3].ELBInfo[i4].NameSelector, - To: reference.To{ - List: &v1beta11.ELBList{}, - Managed: &v1beta11.ELB{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerInfo[i3].ELBInfo[i4].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoadBalancerInfo[i3].ELBInfo[i4].NameRef, + Selector: mg.Spec.ForProvider.LoadBalancerInfo[i3].ELBInfo[i4].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancerInfo[i3].ELBInfo[i4].Name") } @@ -101,16 +142,27 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade for i3 := 0; i3 < len(mg.Spec.ForProvider.LoadBalancerInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].Name), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].NameRef, - Selector: mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].NameSelector, - To: reference.To{ - List: &v1beta12.LBTargetGroupList{}, - Managed: &v1beta12.LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].Name), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].NameRef, + Selector: mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].Name") } @@ -120,16 +172,27 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceRoleArnRef, - Selector: mg.Spec.ForProvider.ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceRoleArnRef, + Selector: mg.Spec.ForProvider.ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceRoleArn") } @@ -137,16 +200,26 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade mg.Spec.ForProvider.ServiceRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.TriggerConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TriggerConfiguration[i3].TriggerTargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TriggerConfiguration[i3].TriggerTargetArnRef, - Selector: mg.Spec.ForProvider.TriggerConfiguration[i3].TriggerTargetArnSelector, - To: reference.To{ - List: &v1beta14.TopicList{}, - Managed: &v1beta14.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TriggerConfiguration[i3].TriggerTargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TriggerConfiguration[i3].TriggerTargetArnRef, + Selector: mg.Spec.ForProvider.TriggerConfiguration[i3].TriggerTargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TriggerConfiguration[i3].TriggerTargetArn") } @@ -155,16 +228,26 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.InitProvider.EcsService); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EcsService[i3].ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EcsService[i3].ClusterNameRef, - Selector: mg.Spec.InitProvider.EcsService[i3].ClusterNameSelector, - To: reference.To{ - List: &v1beta1.ClusterList{}, - Managed: &v1beta1.Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EcsService[i3].ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EcsService[i3].ClusterNameRef, + Selector: mg.Spec.InitProvider.EcsService[i3].ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EcsService[i3].ClusterName") } @@ -173,16 +256,26 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.InitProvider.EcsService); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EcsService[i3].ServiceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EcsService[i3].ServiceNameRef, - Selector: mg.Spec.InitProvider.EcsService[i3].ServiceNameSelector, - To: reference.To{ - List: &v1beta1.ServiceList{}, - Managed: &v1beta1.Service{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Service", + "ServiceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EcsService[i3].ServiceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EcsService[i3].ServiceNameRef, + Selector: mg.Spec.InitProvider.EcsService[i3].ServiceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EcsService[i3].ServiceName") } @@ -192,16 +285,25 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.InitProvider.LoadBalancerInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LoadBalancerInfo[i3].ELBInfo); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerInfo[i3].ELBInfo[i4].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoadBalancerInfo[i3].ELBInfo[i4].NameRef, - Selector: mg.Spec.InitProvider.LoadBalancerInfo[i3].ELBInfo[i4].NameSelector, - To: reference.To{ - List: &v1beta11.ELBList{}, - Managed: &v1beta11.ELB{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerInfo[i3].ELBInfo[i4].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoadBalancerInfo[i3].ELBInfo[i4].NameRef, + Selector: mg.Spec.InitProvider.LoadBalancerInfo[i3].ELBInfo[i4].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancerInfo[i3].ELBInfo[i4].Name") } @@ -213,16 +315,27 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade for i3 := 0; i3 < len(mg.Spec.InitProvider.LoadBalancerInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].Name), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].NameRef, - Selector: mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].NameSelector, - To: reference.To{ - List: &v1beta12.LBTargetGroupList{}, - Managed: &v1beta12.LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].Name), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].NameRef, + Selector: mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancerInfo[i3].TargetGroupPairInfo[i4].TargetGroup[i5].Name") } @@ -232,16 +345,27 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceRoleArnRef, - Selector: mg.Spec.InitProvider.ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceRoleArnRef, + Selector: mg.Spec.InitProvider.ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceRoleArn") } @@ -249,16 +373,26 @@ func (mg *DeploymentGroup) ResolveReferences(ctx context.Context, c client.Reade mg.Spec.InitProvider.ServiceRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.TriggerConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TriggerConfiguration[i3].TriggerTargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TriggerConfiguration[i3].TriggerTargetArnRef, - Selector: mg.Spec.InitProvider.TriggerConfiguration[i3].TriggerTargetArnSelector, - To: reference.To{ - List: &v1beta14.TopicList{}, - Managed: &v1beta14.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TriggerConfiguration[i3].TriggerTargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TriggerConfiguration[i3].TriggerTargetArnRef, + Selector: mg.Spec.InitProvider.TriggerConfiguration[i3].TriggerTargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TriggerConfiguration[i3].TriggerTargetArn") } diff --git a/apis/detective/v1beta1/zz_generated.resolvers.go b/apis/detective/v1beta1/zz_generated.resolvers.go index 3fe9e29e54..65484be3c3 100644 --- a/apis/detective/v1beta1/zz_generated.resolvers.go +++ b/apis/detective/v1beta1/zz_generated.resolvers.go @@ -10,42 +10,66 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this InvitationAccepter. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this InvitationAccepter. func (mg *InvitationAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("detective.aws.upbound.io", + + "v1beta1", + + "Graph", + "GraphList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GraphArn), - Extract: resource.ExtractParamPath("graph_arn", true), - Reference: mg.Spec.ForProvider.GraphArnRef, - Selector: mg.Spec.ForProvider.GraphArnSelector, - To: reference.To{ - List: &GraphList{}, - Managed: &Graph{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GraphArn), + Extract: resource.ExtractParamPath("graph_arn", true), + Reference: mg.Spec.ForProvider.GraphArnRef, + Selector: mg.Spec.ForProvider.GraphArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GraphArn") } mg.Spec.ForProvider.GraphArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GraphArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("detective.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GraphArn), - Extract: resource.ExtractParamPath("graph_arn", true), - Reference: mg.Spec.InitProvider.GraphArnRef, - Selector: mg.Spec.InitProvider.GraphArnSelector, - To: reference.To{ - List: &GraphList{}, - Managed: &Graph{}, - }, - }) + "Graph", + "GraphList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GraphArn), + Extract: resource.ExtractParamPath("graph_arn", true), + Reference: mg.Spec.InitProvider.GraphArnRef, + Selector: mg.Spec.InitProvider.GraphArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GraphArn") } @@ -57,37 +81,58 @@ func (mg *InvitationAccepter) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this Member. func (mg *Member) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("detective.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GraphArn), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GraphArnRef, - Selector: mg.Spec.ForProvider.GraphArnSelector, - To: reference.To{ - List: &GraphList{}, - Managed: &Graph{}, - }, - }) + "Graph", + "GraphList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GraphArn), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GraphArnRef, + Selector: mg.Spec.ForProvider.GraphArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GraphArn") } mg.Spec.ForProvider.GraphArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GraphArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("detective.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GraphArn), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.GraphArnRef, - Selector: mg.Spec.InitProvider.GraphArnSelector, - To: reference.To{ - List: &GraphList{}, - Managed: &Graph{}, - }, - }) + "v1beta1", + + "Graph", + "GraphList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GraphArn), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.GraphArnRef, + Selector: mg.Spec.InitProvider.GraphArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GraphArn") } diff --git a/apis/devicefarm/v1beta1/zz_generated.resolvers.go b/apis/devicefarm/v1beta1/zz_generated.resolvers.go index 054980eeed..872f78326a 100644 --- a/apis/devicefarm/v1beta1/zz_generated.resolvers.go +++ b/apis/devicefarm/v1beta1/zz_generated.resolvers.go @@ -10,43 +10,69 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this DevicePool. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this DevicePool. func (mg *DevicePool) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("devicefarm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProjectArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ProjectArnRef, - Selector: mg.Spec.ForProvider.ProjectArnSelector, - To: reference.To{ - List: &ProjectList{}, - Managed: &Project{}, - }, - }) + "v1beta1", + + "Project", + + "ProjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProjectArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ProjectArnRef, + Selector: mg.Spec.ForProvider.ProjectArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProjectArn") } mg.Spec.ForProvider.ProjectArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProjectArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("devicefarm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProjectArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ProjectArnRef, - Selector: mg.Spec.InitProvider.ProjectArnSelector, - To: reference.To{ - List: &ProjectList{}, - Managed: &Project{}, - }, - }) + "v1beta1", + + "Project", + + "ProjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProjectArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ProjectArnRef, + Selector: mg.Spec.InitProvider.ProjectArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProjectArn") } @@ -58,37 +84,60 @@ func (mg *DevicePool) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this NetworkProfile. func (mg *NetworkProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("devicefarm.aws.upbound.io", + + "v1beta1", + + "Project", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProjectArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ProjectArnRef, - Selector: mg.Spec.ForProvider.ProjectArnSelector, - To: reference.To{ - List: &ProjectList{}, - Managed: &Project{}, - }, - }) + "ProjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProjectArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ProjectArnRef, + Selector: mg.Spec.ForProvider.ProjectArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProjectArn") } mg.Spec.ForProvider.ProjectArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProjectArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("devicefarm.aws.upbound.io", + + "v1beta1", + + "Project", + + "ProjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProjectArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ProjectArnRef, - Selector: mg.Spec.InitProvider.ProjectArnSelector, - To: reference.To{ - List: &ProjectList{}, - Managed: &Project{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProjectArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ProjectArnRef, + Selector: mg.Spec.InitProvider.ProjectArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProjectArn") } @@ -100,6 +149,9 @@ func (mg *NetworkProfile) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this TestGridProject. func (mg *TestGridProject) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -107,16 +159,26 @@ func (mg *TestGridProject) ResolveReferences(ctx context.Context, c client.Reade var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds") } @@ -125,16 +187,26 @@ func (mg *TestGridProject) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SubnetIds") } @@ -143,16 +215,25 @@ func (mg *TestGridProject) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCConfig[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCConfig[i3].VPCIDRef, - Selector: mg.Spec.ForProvider.VPCConfig[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCConfig[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCConfig[i3].VPCIDRef, + Selector: mg.Spec.ForProvider.VPCConfig[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].VPCID") } @@ -161,16 +242,26 @@ func (mg *TestGridProject) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds") } @@ -179,16 +270,26 @@ func (mg *TestGridProject) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SubnetIds") } @@ -197,16 +298,25 @@ func (mg *TestGridProject) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCConfig[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCConfig[i3].VPCIDRef, - Selector: mg.Spec.InitProvider.VPCConfig[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCConfig[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCConfig[i3].VPCIDRef, + Selector: mg.Spec.InitProvider.VPCConfig[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].VPCID") } @@ -220,37 +330,60 @@ func (mg *TestGridProject) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this Upload. func (mg *Upload) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("devicefarm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProjectArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ProjectArnRef, - Selector: mg.Spec.ForProvider.ProjectArnSelector, - To: reference.To{ - List: &ProjectList{}, - Managed: &Project{}, - }, - }) + "Project", + + "ProjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProjectArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ProjectArnRef, + Selector: mg.Spec.ForProvider.ProjectArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProjectArn") } mg.Spec.ForProvider.ProjectArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProjectArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("devicefarm.aws.upbound.io", + + "v1beta1", + + "Project", + + "ProjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProjectArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ProjectArnRef, - Selector: mg.Spec.InitProvider.ProjectArnSelector, - To: reference.To{ - List: &ProjectList{}, - Managed: &Project{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProjectArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ProjectArnRef, + Selector: mg.Spec.InitProvider.ProjectArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProjectArn") } diff --git a/apis/directconnect/v1beta1/zz_generated.resolvers.go b/apis/directconnect/v1beta1/zz_generated.resolvers.go index 8565790eb0..1cc4cef463 100644 --- a/apis/directconnect/v1beta1/zz_generated.resolvers.go +++ b/apis/directconnect/v1beta1/zz_generated.resolvers.go @@ -10,43 +10,67 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this BGPPeer. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this BGPPeer. func (mg *BGPPeer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualInterfaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VirtualInterfaceIDRef, - Selector: mg.Spec.ForProvider.VirtualInterfaceIDSelector, - To: reference.To{ - List: &PrivateVirtualInterfaceList{}, - Managed: &PrivateVirtualInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "PrivateVirtualInterface", + + "PrivateVirtualInterfaceList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualInterfaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VirtualInterfaceIDRef, + Selector: mg.Spec.ForProvider.VirtualInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VirtualInterfaceID") } mg.Spec.ForProvider.VirtualInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VirtualInterfaceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualInterfaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VirtualInterfaceIDRef, - Selector: mg.Spec.InitProvider.VirtualInterfaceIDSelector, - To: reference.To{ - List: &PrivateVirtualInterfaceList{}, - Managed: &PrivateVirtualInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "PrivateVirtualInterface", + + "PrivateVirtualInterfaceList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualInterfaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VirtualInterfaceIDRef, + Selector: mg.Spec.InitProvider.VirtualInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VirtualInterfaceID") } @@ -58,69 +82,102 @@ func (mg *BGPPeer) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ConnectionAssociation. func (mg *ConnectionAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LagID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.LagIDRef, - Selector: mg.Spec.ForProvider.LagIDSelector, - To: reference.To{ - List: &LagList{}, - Managed: &Lag{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Lag", "LagList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LagID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.LagIDRef, + Selector: mg.Spec.ForProvider.LagIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LagID") } mg.Spec.ForProvider.LagID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LagIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } mg.Spec.InitProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LagID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.LagIDRef, - Selector: mg.Spec.InitProvider.LagIDSelector, - To: reference.To{ - List: &LagList{}, - Managed: &Lag{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Lag", "LagList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LagID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.LagIDRef, + Selector: mg.Spec.InitProvider.LagIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LagID") } @@ -132,69 +189,106 @@ func (mg *ConnectionAssociation) ResolveReferences(ctx context.Context, c client // ResolveReferences of this GatewayAssociation. func (mg *GatewayAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AssociatedGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AssociatedGatewayIDRef, - Selector: mg.Spec.ForProvider.AssociatedGatewayIDSelector, - To: reference.To{ - List: &v1beta1.VPNGatewayList{}, - Managed: &v1beta1.VPNGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AssociatedGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AssociatedGatewayIDRef, + Selector: mg.Spec.ForProvider.AssociatedGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AssociatedGatewayID") } mg.Spec.ForProvider.AssociatedGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AssociatedGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DxGatewayIDRef, - Selector: mg.Spec.ForProvider.DxGatewayIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DxGatewayIDRef, + Selector: mg.Spec.ForProvider.DxGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DxGatewayID") } mg.Spec.ForProvider.DxGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DxGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AssociatedGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.AssociatedGatewayIDRef, - Selector: mg.Spec.InitProvider.AssociatedGatewayIDSelector, - To: reference.To{ - List: &v1beta1.VPNGatewayList{}, - Managed: &v1beta1.VPNGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AssociatedGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.AssociatedGatewayIDRef, + Selector: mg.Spec.InitProvider.AssociatedGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AssociatedGatewayID") } mg.Spec.InitProvider.AssociatedGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AssociatedGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DxGatewayIDRef, - Selector: mg.Spec.InitProvider.DxGatewayIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DxGatewayIDRef, + Selector: mg.Spec.InitProvider.DxGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DxGatewayID") } @@ -206,101 +300,154 @@ func (mg *GatewayAssociation) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this GatewayAssociationProposal. func (mg *GatewayAssociationProposal) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AssociatedGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AssociatedGatewayIDRef, - Selector: mg.Spec.ForProvider.AssociatedGatewayIDSelector, - To: reference.To{ - List: &v1beta1.VPNGatewayList{}, - Managed: &v1beta1.VPNGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AssociatedGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AssociatedGatewayIDRef, + Selector: mg.Spec.ForProvider.AssociatedGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AssociatedGatewayID") } mg.Spec.ForProvider.AssociatedGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AssociatedGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DxGatewayIDRef, - Selector: mg.Spec.ForProvider.DxGatewayIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DxGatewayIDRef, + Selector: mg.Spec.ForProvider.DxGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DxGatewayID") } mg.Spec.ForProvider.DxGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DxGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayOwnerAccountID), - Extract: resource.ExtractParamPath("owner_account_id", true), - Reference: mg.Spec.ForProvider.DxGatewayOwnerAccountIDRef, - Selector: mg.Spec.ForProvider.DxGatewayOwnerAccountIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayOwnerAccountID), + Extract: resource.ExtractParamPath("owner_account_id", true), + Reference: mg.Spec.ForProvider.DxGatewayOwnerAccountIDRef, + Selector: mg.Spec.ForProvider.DxGatewayOwnerAccountIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DxGatewayOwnerAccountID") } mg.Spec.ForProvider.DxGatewayOwnerAccountID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DxGatewayOwnerAccountIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AssociatedGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.AssociatedGatewayIDRef, - Selector: mg.Spec.InitProvider.AssociatedGatewayIDSelector, - To: reference.To{ - List: &v1beta1.VPNGatewayList{}, - Managed: &v1beta1.VPNGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AssociatedGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.AssociatedGatewayIDRef, + Selector: mg.Spec.InitProvider.AssociatedGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AssociatedGatewayID") } mg.Spec.InitProvider.AssociatedGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AssociatedGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DxGatewayIDRef, - Selector: mg.Spec.InitProvider.DxGatewayIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DxGatewayIDRef, + Selector: mg.Spec.InitProvider.DxGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DxGatewayID") } mg.Spec.InitProvider.DxGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DxGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayOwnerAccountID), - Extract: resource.ExtractParamPath("owner_account_id", true), - Reference: mg.Spec.InitProvider.DxGatewayOwnerAccountIDRef, - Selector: mg.Spec.InitProvider.DxGatewayOwnerAccountIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayOwnerAccountID), + Extract: resource.ExtractParamPath("owner_account_id", true), + Reference: mg.Spec.InitProvider.DxGatewayOwnerAccountIDRef, + Selector: mg.Spec.InitProvider.DxGatewayOwnerAccountIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DxGatewayOwnerAccountID") } @@ -312,37 +459,56 @@ func (mg *GatewayAssociationProposal) ResolveReferences(ctx context.Context, c c // ResolveReferences of this HostedPrivateVirtualInterface. func (mg *HostedPrivateVirtualInterface) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } @@ -354,69 +520,106 @@ func (mg *HostedPrivateVirtualInterface) ResolveReferences(ctx context.Context, // ResolveReferences of this HostedPrivateVirtualInterfaceAccepter. func (mg *HostedPrivateVirtualInterfaceAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPNGatewayIDRef, - Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &v1beta1.VPNGatewayList{}, - Managed: &v1beta1.VPNGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPNGatewayIDRef, + Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPNGatewayID") } mg.Spec.ForProvider.VPNGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPNGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VirtualInterfaceIDRef, - Selector: mg.Spec.ForProvider.VirtualInterfaceIDSelector, - To: reference.To{ - List: &HostedPrivateVirtualInterfaceList{}, - Managed: &HostedPrivateVirtualInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "HostedPrivateVirtualInterface", + + "HostedPrivateVirtualInterfaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VirtualInterfaceIDRef, + Selector: mg.Spec.ForProvider.VirtualInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VirtualInterfaceID") } mg.Spec.ForProvider.VirtualInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VirtualInterfaceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPNGatewayIDRef, - Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &v1beta1.VPNGatewayList{}, - Managed: &v1beta1.VPNGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPNGatewayIDRef, + Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPNGatewayID") } mg.Spec.InitProvider.VPNGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.VPNGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VirtualInterfaceIDRef, - Selector: mg.Spec.InitProvider.VirtualInterfaceIDSelector, - To: reference.To{ - List: &HostedPrivateVirtualInterfaceList{}, - Managed: &HostedPrivateVirtualInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "HostedPrivateVirtualInterface", + + "HostedPrivateVirtualInterfaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VirtualInterfaceIDRef, + Selector: mg.Spec.InitProvider.VirtualInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VirtualInterfaceID") } @@ -428,37 +631,56 @@ func (mg *HostedPrivateVirtualInterfaceAccepter) ResolveReferences(ctx context.C // ResolveReferences of this HostedPublicVirtualInterface. func (mg *HostedPublicVirtualInterface) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } @@ -470,37 +692,56 @@ func (mg *HostedPublicVirtualInterface) ResolveReferences(ctx context.Context, c // ResolveReferences of this HostedPublicVirtualInterfaceAccepter. func (mg *HostedPublicVirtualInterfaceAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VirtualInterfaceIDRef, - Selector: mg.Spec.ForProvider.VirtualInterfaceIDSelector, - To: reference.To{ - List: &HostedPublicVirtualInterfaceList{}, - Managed: &HostedPublicVirtualInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "HostedPublicVirtualInterface", + + "HostedPublicVirtualInterfaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VirtualInterfaceIDRef, + Selector: mg.Spec.ForProvider.VirtualInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VirtualInterfaceID") } mg.Spec.ForProvider.VirtualInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VirtualInterfaceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VirtualInterfaceIDRef, - Selector: mg.Spec.InitProvider.VirtualInterfaceIDSelector, - To: reference.To{ - List: &HostedPublicVirtualInterfaceList{}, - Managed: &HostedPublicVirtualInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "HostedPublicVirtualInterface", + + "HostedPublicVirtualInterfaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VirtualInterfaceIDRef, + Selector: mg.Spec.InitProvider.VirtualInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VirtualInterfaceID") } @@ -512,37 +753,56 @@ func (mg *HostedPublicVirtualInterfaceAccepter) ResolveReferences(ctx context.Co // ResolveReferences of this HostedTransitVirtualInterface. func (mg *HostedTransitVirtualInterface) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } @@ -554,69 +814,104 @@ func (mg *HostedTransitVirtualInterface) ResolveReferences(ctx context.Context, // ResolveReferences of this HostedTransitVirtualInterfaceAccepter. func (mg *HostedTransitVirtualInterfaceAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DxGatewayIDRef, - Selector: mg.Spec.ForProvider.DxGatewayIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DxGatewayIDRef, + Selector: mg.Spec.ForProvider.DxGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DxGatewayID") } mg.Spec.ForProvider.DxGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DxGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VirtualInterfaceIDRef, - Selector: mg.Spec.ForProvider.VirtualInterfaceIDSelector, - To: reference.To{ - List: &HostedTransitVirtualInterfaceList{}, - Managed: &HostedTransitVirtualInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "HostedTransitVirtualInterface", + + "HostedTransitVirtualInterfaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VirtualInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VirtualInterfaceIDRef, + Selector: mg.Spec.ForProvider.VirtualInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VirtualInterfaceID") } mg.Spec.ForProvider.VirtualInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VirtualInterfaceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DxGatewayIDRef, - Selector: mg.Spec.InitProvider.DxGatewayIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DxGatewayIDRef, + Selector: mg.Spec.InitProvider.DxGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DxGatewayID") } mg.Spec.InitProvider.DxGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DxGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VirtualInterfaceIDRef, - Selector: mg.Spec.InitProvider.VirtualInterfaceIDSelector, - To: reference.To{ - List: &HostedTransitVirtualInterfaceList{}, - Managed: &HostedTransitVirtualInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "HostedTransitVirtualInterface", + + "HostedTransitVirtualInterfaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VirtualInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VirtualInterfaceIDRef, + Selector: mg.Spec.InitProvider.VirtualInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VirtualInterfaceID") } @@ -628,69 +923,106 @@ func (mg *HostedTransitVirtualInterfaceAccepter) ResolveReferences(ctx context.C // ResolveReferences of this PrivateVirtualInterface. func (mg *PrivateVirtualInterface) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPNGatewayIDRef, - Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &v1beta1.VPNGatewayList{}, - Managed: &v1beta1.VPNGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPNGatewayIDRef, + Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPNGatewayID") } mg.Spec.ForProvider.VPNGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPNGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } mg.Spec.InitProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPNGatewayIDRef, - Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &v1beta1.VPNGatewayList{}, - Managed: &v1beta1.VPNGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPNGatewayIDRef, + Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPNGatewayID") } @@ -702,37 +1034,56 @@ func (mg *PrivateVirtualInterface) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this PublicVirtualInterface. func (mg *PublicVirtualInterface) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } @@ -744,69 +1095,104 @@ func (mg *PublicVirtualInterface) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this TransitVirtualInterface. func (mg *TransitVirtualInterface) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ConnectionIDRef, - Selector: mg.Spec.ForProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ConnectionIDRef, + Selector: mg.Spec.ForProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionID") } mg.Spec.ForProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DxGatewayIDRef, - Selector: mg.Spec.ForProvider.DxGatewayIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DxGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DxGatewayIDRef, + Selector: mg.Spec.ForProvider.DxGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DxGatewayID") } mg.Spec.ForProvider.DxGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DxGatewayIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ConnectionIDRef, - Selector: mg.Spec.InitProvider.ConnectionIDSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Connection", + + "ConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ConnectionIDRef, + Selector: mg.Spec.InitProvider.ConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionID") } mg.Spec.InitProvider.ConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConnectionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DxGatewayIDRef, - Selector: mg.Spec.InitProvider.DxGatewayIDSelector, - To: reference.To{ - List: &GatewayList{}, - Managed: &Gateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("directconnect.aws.upbound.io", + + "v1beta1", + "Gateway", + + "GatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DxGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DxGatewayIDRef, + Selector: mg.Spec.InitProvider.DxGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DxGatewayID") } diff --git a/apis/dlm/v1beta1/zz_generated.resolvers.go b/apis/dlm/v1beta1/zz_generated.resolvers.go index 6fb7af7938..fef185d986 100644 --- a/apis/dlm/v1beta1/zz_generated.resolvers.go +++ b/apis/dlm/v1beta1/zz_generated.resolvers.go @@ -10,29 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this LifecyclePolicy. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this LifecyclePolicy. func (mg *LifecyclePolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ExecutionRoleArnRef, - Selector: mg.Spec.ForProvider.ExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ExecutionRoleArnRef, + Selector: mg.Spec.ForProvider.ExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExecutionRoleArn") } @@ -42,16 +57,25 @@ func (mg *LifecyclePolicy) ResolveReferences(ctx context.Context, c client.Reade for i3 := 0; i3 < len(mg.Spec.ForProvider.PolicyDetails); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.PolicyDetails[i3].Schedule); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnRef, - Selector: mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnRef, + Selector: mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArn") } @@ -61,16 +85,27 @@ func (mg *LifecyclePolicy) ResolveReferences(ctx context.Context, c client.Reade } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ExecutionRoleArnRef, - Selector: mg.Spec.InitProvider.ExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ExecutionRoleArnRef, + Selector: mg.Spec.InitProvider.ExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExecutionRoleArn") } @@ -80,16 +115,25 @@ func (mg *LifecyclePolicy) ResolveReferences(ctx context.Context, c client.Reade for i3 := 0; i3 < len(mg.Spec.InitProvider.PolicyDetails); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.PolicyDetails[i3].Schedule); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnRef, - Selector: mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnRef, + Selector: mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArn") } diff --git a/apis/dms/v1beta1/zz_generated.resolvers.go b/apis/dms/v1beta1/zz_generated.resolvers.go index 073ff75f32..1b94cbe7ad 100644 --- a/apis/dms/v1beta1/zz_generated.resolvers.go +++ b/apis/dms/v1beta1/zz_generated.resolvers.go @@ -10,111 +10,170 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta13 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Endpoint. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Endpoint. func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecretsManagerAccessRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.SecretsManagerAccessRoleArnRef, - Selector: mg.Spec.ForProvider.SecretsManagerAccessRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecretsManagerAccessRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.SecretsManagerAccessRoleArnRef, + Selector: mg.Spec.ForProvider.SecretsManagerAccessRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecretsManagerAccessRoleArn") } mg.Spec.ForProvider.SecretsManagerAccessRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecretsManagerAccessRoleArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceAccessRole), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceAccessRoleRef, - Selector: mg.Spec.ForProvider.ServiceAccessRoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceAccessRole), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceAccessRoleRef, + Selector: mg.Spec.ForProvider.ServiceAccessRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceAccessRole") } mg.Spec.ForProvider.ServiceAccessRole = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServiceAccessRoleRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } mg.Spec.InitProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecretsManagerAccessRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.SecretsManagerAccessRoleArnRef, - Selector: mg.Spec.InitProvider.SecretsManagerAccessRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecretsManagerAccessRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.SecretsManagerAccessRoleArnRef, + Selector: mg.Spec.InitProvider.SecretsManagerAccessRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecretsManagerAccessRoleArn") } mg.Spec.InitProvider.SecretsManagerAccessRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SecretsManagerAccessRoleArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceAccessRole), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceAccessRoleRef, - Selector: mg.Spec.InitProvider.ServiceAccessRoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceAccessRole), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceAccessRoleRef, + Selector: mg.Spec.InitProvider.ServiceAccessRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceAccessRole") } @@ -126,37 +185,58 @@ func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this EventSubscription. func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SnsTopicArnRef, - Selector: mg.Spec.ForProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SnsTopicArnRef, + Selector: mg.Spec.ForProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnsTopicArn") } mg.Spec.ForProvider.SnsTopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnsTopicArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SnsTopicArnRef, - Selector: mg.Spec.InitProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SnsTopicArnRef, + Selector: mg.Spec.InitProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnsTopicArn") } @@ -168,102 +248,161 @@ func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this ReplicationInstance. func (mg *ReplicationInstance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicationSubnetGroupID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ReplicationSubnetGroupIDRef, - Selector: mg.Spec.ForProvider.ReplicationSubnetGroupIDSelector, - To: reference.To{ - List: &ReplicationSubnetGroupList{}, - Managed: &ReplicationSubnetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("dms.aws.upbound.io", + + "v1beta1", + + "ReplicationSubnetGroup", + + "ReplicationSubnetGroupList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicationSubnetGroupID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ReplicationSubnetGroupIDRef, + Selector: mg.Spec.ForProvider.ReplicationSubnetGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ReplicationSubnetGroupID") } mg.Spec.ForProvider.ReplicationSubnetGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ReplicationSubnetGroupIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } mg.Spec.InitProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicationSubnetGroupID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ReplicationSubnetGroupIDRef, - Selector: mg.Spec.InitProvider.ReplicationSubnetGroupIDSelector, - To: reference.To{ - List: &ReplicationSubnetGroupList{}, - Managed: &ReplicationSubnetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("dms.aws.upbound.io", + + "v1beta1", + + "ReplicationSubnetGroup", + + "ReplicationSubnetGroupList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicationSubnetGroupID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ReplicationSubnetGroupIDRef, + Selector: mg.Spec.InitProvider.ReplicationSubnetGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ReplicationSubnetGroupID") } mg.Spec.InitProvider.ReplicationSubnetGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ReplicationSubnetGroupIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -275,37 +414,58 @@ func (mg *ReplicationInstance) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this ReplicationSubnetGroup. func (mg *ReplicationSubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } @@ -317,101 +477,158 @@ func (mg *ReplicationSubnetGroup) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this ReplicationTask. func (mg *ReplicationTask) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("dms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicationInstanceArn), - Extract: resource.ExtractParamPath("replication_instance_arn", true), - Reference: mg.Spec.ForProvider.ReplicationInstanceArnRef, - Selector: mg.Spec.ForProvider.ReplicationInstanceArnSelector, - To: reference.To{ - List: &ReplicationInstanceList{}, - Managed: &ReplicationInstance{}, - }, - }) + "v1beta1", + + "ReplicationInstance", + + "ReplicationInstanceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicationInstanceArn), + Extract: resource.ExtractParamPath("replication_instance_arn", true), + Reference: mg.Spec.ForProvider.ReplicationInstanceArnRef, + Selector: mg.Spec.ForProvider.ReplicationInstanceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ReplicationInstanceArn") } mg.Spec.ForProvider.ReplicationInstanceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ReplicationInstanceArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceEndpointArn), - Extract: resource.ExtractParamPath("endpoint_arn", true), - Reference: mg.Spec.ForProvider.SourceEndpointArnRef, - Selector: mg.Spec.ForProvider.SourceEndpointArnSelector, - To: reference.To{ - List: &EndpointList{}, - Managed: &Endpoint{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("dms.aws.upbound.io", + + "v1beta1", + + "Endpoint", + "EndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceEndpointArn), + Extract: resource.ExtractParamPath("endpoint_arn", true), + Reference: mg.Spec.ForProvider.SourceEndpointArnRef, + Selector: mg.Spec.ForProvider.SourceEndpointArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceEndpointArn") } mg.Spec.ForProvider.SourceEndpointArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceEndpointArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetEndpointArn), - Extract: resource.ExtractParamPath("endpoint_arn", true), - Reference: mg.Spec.ForProvider.TargetEndpointArnRef, - Selector: mg.Spec.ForProvider.TargetEndpointArnSelector, - To: reference.To{ - List: &EndpointList{}, - Managed: &Endpoint{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("dms.aws.upbound.io", + + "v1beta1", + + "Endpoint", + "EndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetEndpointArn), + Extract: resource.ExtractParamPath("endpoint_arn", true), + Reference: mg.Spec.ForProvider.TargetEndpointArnRef, + Selector: mg.Spec.ForProvider.TargetEndpointArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetEndpointArn") } mg.Spec.ForProvider.TargetEndpointArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetEndpointArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("dms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicationInstanceArn), - Extract: resource.ExtractParamPath("replication_instance_arn", true), - Reference: mg.Spec.InitProvider.ReplicationInstanceArnRef, - Selector: mg.Spec.InitProvider.ReplicationInstanceArnSelector, - To: reference.To{ - List: &ReplicationInstanceList{}, - Managed: &ReplicationInstance{}, - }, - }) + "v1beta1", + + "ReplicationInstance", + + "ReplicationInstanceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicationInstanceArn), + Extract: resource.ExtractParamPath("replication_instance_arn", true), + Reference: mg.Spec.InitProvider.ReplicationInstanceArnRef, + Selector: mg.Spec.InitProvider.ReplicationInstanceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ReplicationInstanceArn") } mg.Spec.InitProvider.ReplicationInstanceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ReplicationInstanceArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceEndpointArn), - Extract: resource.ExtractParamPath("endpoint_arn", true), - Reference: mg.Spec.InitProvider.SourceEndpointArnRef, - Selector: mg.Spec.InitProvider.SourceEndpointArnSelector, - To: reference.To{ - List: &EndpointList{}, - Managed: &Endpoint{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("dms.aws.upbound.io", + + "v1beta1", + + "Endpoint", + "EndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceEndpointArn), + Extract: resource.ExtractParamPath("endpoint_arn", true), + Reference: mg.Spec.InitProvider.SourceEndpointArnRef, + Selector: mg.Spec.InitProvider.SourceEndpointArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceEndpointArn") } mg.Spec.InitProvider.SourceEndpointArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SourceEndpointArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetEndpointArn), - Extract: resource.ExtractParamPath("endpoint_arn", true), - Reference: mg.Spec.InitProvider.TargetEndpointArnRef, - Selector: mg.Spec.InitProvider.TargetEndpointArnSelector, - To: reference.To{ - List: &EndpointList{}, - Managed: &Endpoint{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("dms.aws.upbound.io", + + "v1beta1", + + "Endpoint", + "EndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetEndpointArn), + Extract: resource.ExtractParamPath("endpoint_arn", true), + Reference: mg.Spec.InitProvider.TargetEndpointArnRef, + Selector: mg.Spec.InitProvider.TargetEndpointArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetEndpointArn") } @@ -423,101 +640,156 @@ func (mg *ReplicationTask) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this S3Endpoint. func (mg *S3Endpoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServerSideEncryptionKMSKeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ServerSideEncryptionKMSKeyIDRef, - Selector: mg.Spec.ForProvider.ServerSideEncryptionKMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServerSideEncryptionKMSKeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ServerSideEncryptionKMSKeyIDRef, + Selector: mg.Spec.ForProvider.ServerSideEncryptionKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServerSideEncryptionKMSKeyID") } mg.Spec.ForProvider.ServerSideEncryptionKMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServerSideEncryptionKMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceAccessRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceAccessRoleArnRef, - Selector: mg.Spec.ForProvider.ServiceAccessRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceAccessRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceAccessRoleArnRef, + Selector: mg.Spec.ForProvider.ServiceAccessRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceAccessRoleArn") } mg.Spec.ForProvider.ServiceAccessRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServiceAccessRoleArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } mg.Spec.InitProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServerSideEncryptionKMSKeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ServerSideEncryptionKMSKeyIDRef, - Selector: mg.Spec.InitProvider.ServerSideEncryptionKMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServerSideEncryptionKMSKeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ServerSideEncryptionKMSKeyIDRef, + Selector: mg.Spec.InitProvider.ServerSideEncryptionKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServerSideEncryptionKMSKeyID") } mg.Spec.InitProvider.ServerSideEncryptionKMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ServerSideEncryptionKMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceAccessRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceAccessRoleArnRef, - Selector: mg.Spec.InitProvider.ServiceAccessRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceAccessRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceAccessRoleArnRef, + Selector: mg.Spec.InitProvider.ServiceAccessRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceAccessRoleArn") } diff --git a/apis/docdb/v1beta1/zz_generated.resolvers.go b/apis/docdb/v1beta1/zz_generated.resolvers.go index 1bc7735565..c4e5627117 100644 --- a/apis/docdb/v1beta1/zz_generated.resolvers.go +++ b/apis/docdb/v1beta1/zz_generated.resolvers.go @@ -10,110 +10,170 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Cluster. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DBClusterParameterGroupNameRef, - Selector: mg.Spec.ForProvider.DBClusterParameterGroupNameSelector, - To: reference.To{ - List: &ClusterParameterGroupList{}, - Managed: &ClusterParameterGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("docdb.aws.upbound.io", + + "v1beta1", + + "ClusterParameterGroup", + + "ClusterParameterGroupList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DBClusterParameterGroupNameRef, + Selector: mg.Spec.ForProvider.DBClusterParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBClusterParameterGroupName") } mg.Spec.ForProvider.DBClusterParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBClusterParameterGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DBClusterParameterGroupNameRef, - Selector: mg.Spec.InitProvider.DBClusterParameterGroupNameSelector, - To: reference.To{ - List: &ClusterParameterGroupList{}, - Managed: &ClusterParameterGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("docdb.aws.upbound.io", + + "v1beta1", + + "ClusterParameterGroup", + + "ClusterParameterGroupList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DBClusterParameterGroupNameRef, + Selector: mg.Spec.InitProvider.DBClusterParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBClusterParameterGroupName") } mg.Spec.InitProvider.DBClusterParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DBClusterParameterGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -125,37 +185,58 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ClusterInstance. func (mg *ClusterInstance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterIdentifierRef, - Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("docdb.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterIdentifierRef, + Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterIdentifier") } mg.Spec.ForProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterIdentifierRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterIdentifierRef, - Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("docdb.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterIdentifierRef, + Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterIdentifier") } @@ -167,37 +248,58 @@ func (mg *ClusterInstance) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this ClusterSnapshot. func (mg *ClusterSnapshot) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DBClusterIdentifierRef, - Selector: mg.Spec.ForProvider.DBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("docdb.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DBClusterIdentifierRef, + Selector: mg.Spec.ForProvider.DBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBClusterIdentifier") } mg.Spec.ForProvider.DBClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBClusterIdentifierRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DBClusterIdentifierRef, - Selector: mg.Spec.InitProvider.DBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("docdb.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DBClusterIdentifierRef, + Selector: mg.Spec.InitProvider.DBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBClusterIdentifier") } @@ -209,37 +311,58 @@ func (mg *ClusterSnapshot) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this EventSubscription. func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SnsTopicArnRef, - Selector: mg.Spec.ForProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SnsTopicArnRef, + Selector: mg.Spec.ForProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnsTopicArn") } mg.Spec.ForProvider.SnsTopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnsTopicArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SnsTopicArnRef, - Selector: mg.Spec.InitProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SnsTopicArnRef, + Selector: mg.Spec.InitProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnsTopicArn") } @@ -251,37 +374,58 @@ func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this GlobalCluster. func (mg *GlobalCluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBClusterIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SourceDBClusterIdentifierRef, - Selector: mg.Spec.ForProvider.SourceDBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("docdb.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBClusterIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SourceDBClusterIdentifierRef, + Selector: mg.Spec.ForProvider.SourceDBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceDBClusterIdentifier") } mg.Spec.ForProvider.SourceDBClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceDBClusterIdentifierRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBClusterIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SourceDBClusterIdentifierRef, - Selector: mg.Spec.InitProvider.SourceDBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("docdb.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBClusterIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SourceDBClusterIdentifierRef, + Selector: mg.Spec.InitProvider.SourceDBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceDBClusterIdentifier") } @@ -293,37 +437,58 @@ func (mg *GlobalCluster) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this SubnetGroup. func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIdsRefs, - Selector: mg.Spec.ForProvider.SubnetIdsSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIdsRefs, + Selector: mg.Spec.ForProvider.SubnetIdsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIdsRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIdsRefs, - Selector: mg.Spec.InitProvider.SubnetIdsSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIdsRefs, + Selector: mg.Spec.InitProvider.SubnetIdsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/ds/v1beta1/zz_generated.resolvers.go b/apis/ds/v1beta1/zz_generated.resolvers.go index 84103c0ae8..2d328c83e3 100644 --- a/apis/ds/v1beta1/zz_generated.resolvers.go +++ b/apis/ds/v1beta1/zz_generated.resolvers.go @@ -10,27 +10,42 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ConditionalForwarder. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ConditionalForwarder. func (mg *ConditionalForwarder) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DirectoryIDRef, - Selector: mg.Spec.ForProvider.DirectoryIDSelector, - To: reference.To{ - List: &DirectoryList{}, - Managed: &Directory{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DirectoryIDRef, + Selector: mg.Spec.ForProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DirectoryID") } @@ -42,6 +57,9 @@ func (mg *ConditionalForwarder) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this Directory. func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -49,16 +67,26 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.ConnectSettings); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.ConnectSettings[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.ConnectSettings[i3].SubnetIdsRefs, - Selector: mg.Spec.ForProvider.ConnectSettings[i3].SubnetIdsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.ConnectSettings[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.ConnectSettings[i3].SubnetIdsRefs, + Selector: mg.Spec.ForProvider.ConnectSettings[i3].SubnetIdsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectSettings[i3].SubnetIds") } @@ -67,16 +95,25 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.ConnectSettings); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectSettings[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ConnectSettings[i3].VPCIDRef, - Selector: mg.Spec.ForProvider.ConnectSettings[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectSettings[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ConnectSettings[i3].VPCIDRef, + Selector: mg.Spec.ForProvider.ConnectSettings[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectSettings[i3].VPCID") } @@ -85,16 +122,26 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCSettings); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSettings[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSettings[i3].SubnetIdsRefs, - Selector: mg.Spec.ForProvider.VPCSettings[i3].SubnetIdsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSettings[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSettings[i3].SubnetIdsRefs, + Selector: mg.Spec.ForProvider.VPCSettings[i3].SubnetIdsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSettings[i3].SubnetIds") } @@ -103,16 +150,25 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCSettings); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCSettings[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCSettings[i3].VPCIDRef, - Selector: mg.Spec.ForProvider.VPCSettings[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCSettings[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCSettings[i3].VPCIDRef, + Selector: mg.Spec.ForProvider.VPCSettings[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSettings[i3].VPCID") } @@ -121,16 +177,26 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.ConnectSettings); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.ConnectSettings[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.ConnectSettings[i3].SubnetIdsRefs, - Selector: mg.Spec.InitProvider.ConnectSettings[i3].SubnetIdsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.ConnectSettings[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.ConnectSettings[i3].SubnetIdsRefs, + Selector: mg.Spec.InitProvider.ConnectSettings[i3].SubnetIdsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectSettings[i3].SubnetIds") } @@ -139,16 +205,25 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.ConnectSettings); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectSettings[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ConnectSettings[i3].VPCIDRef, - Selector: mg.Spec.InitProvider.ConnectSettings[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectSettings[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ConnectSettings[i3].VPCIDRef, + Selector: mg.Spec.InitProvider.ConnectSettings[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectSettings[i3].VPCID") } @@ -157,16 +232,26 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCSettings); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSettings[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSettings[i3].SubnetIdsRefs, - Selector: mg.Spec.InitProvider.VPCSettings[i3].SubnetIdsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSettings[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSettings[i3].SubnetIdsRefs, + Selector: mg.Spec.InitProvider.VPCSettings[i3].SubnetIdsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSettings[i3].SubnetIds") } @@ -175,16 +260,25 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCSettings); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCSettings[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCSettings[i3].VPCIDRef, - Selector: mg.Spec.InitProvider.VPCSettings[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCSettings[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCSettings[i3].VPCIDRef, + Selector: mg.Spec.InitProvider.VPCSettings[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSettings[i3].VPCID") } @@ -198,37 +292,58 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this SharedDirectory. func (mg *SharedDirectory) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DirectoryIDRef, - Selector: mg.Spec.ForProvider.DirectoryIDSelector, - To: reference.To{ - List: &DirectoryList{}, - Managed: &Directory{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DirectoryIDRef, + Selector: mg.Spec.ForProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DirectoryID") } mg.Spec.ForProvider.DirectoryID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DirectoryIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DirectoryIDRef, - Selector: mg.Spec.InitProvider.DirectoryIDSelector, - To: reference.To{ - List: &DirectoryList{}, - Managed: &Directory{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DirectoryIDRef, + Selector: mg.Spec.InitProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DirectoryID") } diff --git a/apis/dynamodb/v1beta1/zz_generated.resolvers.go b/apis/dynamodb/v1beta1/zz_generated.resolvers.go index c36b4bbda3..954495eec4 100644 --- a/apis/dynamodb/v1beta1/zz_generated.resolvers.go +++ b/apis/dynamodb/v1beta1/zz_generated.resolvers.go @@ -10,45 +10,68 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ContributorInsights. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ContributorInsights. func (mg *ContributorInsights) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TableNameRef, - Selector: mg.Spec.ForProvider.TableNameSelector, - To: reference.To{ - List: &TableList{}, - Managed: &Table{}, - }, - }) + "v1beta1", + + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TableNameRef, + Selector: mg.Spec.ForProvider.TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TableName") } mg.Spec.ForProvider.TableName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TableNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TableNameRef, - Selector: mg.Spec.InitProvider.TableNameSelector, - To: reference.To{ - List: &TableList{}, - Managed: &Table{}, - }, - }) + "v1beta1", + + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TableNameRef, + Selector: mg.Spec.InitProvider.TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TableName") } @@ -60,69 +83,108 @@ func (mg *ContributorInsights) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this KinesisStreamingDestination. func (mg *KinesisStreamingDestination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StreamArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.StreamArnRef, - Selector: mg.Spec.ForProvider.StreamArnSelector, - To: reference.To{ - List: &v1beta1.StreamList{}, - Managed: &v1beta1.Stream{}, - }, - }) + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StreamArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.StreamArnRef, + Selector: mg.Spec.ForProvider.StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StreamArn") } mg.Spec.ForProvider.StreamArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StreamArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TableNameRef, - Selector: mg.Spec.ForProvider.TableNameSelector, - To: reference.To{ - List: &TableList{}, - Managed: &Table{}, - }, - }) + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TableNameRef, + Selector: mg.Spec.ForProvider.TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TableName") } mg.Spec.ForProvider.TableName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TableNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StreamArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.StreamArnRef, - Selector: mg.Spec.InitProvider.StreamArnSelector, - To: reference.To{ - List: &v1beta1.StreamList{}, - Managed: &v1beta1.Stream{}, - }, - }) + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StreamArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.StreamArnRef, + Selector: mg.Spec.InitProvider.StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StreamArn") } mg.Spec.InitProvider.StreamArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.StreamArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", + + "v1beta1", + + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TableNameRef, - Selector: mg.Spec.InitProvider.TableNameSelector, - To: reference.To{ - List: &TableList{}, - Managed: &Table{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TableNameRef, + Selector: mg.Spec.InitProvider.TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TableName") } @@ -134,37 +196,58 @@ func (mg *KinesisStreamingDestination) ResolveReferences(ctx context.Context, c // ResolveReferences of this TableItem. func (mg *TableItem) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TableNameRef, - Selector: mg.Spec.ForProvider.TableNameSelector, - To: reference.To{ - List: &TableList{}, - Managed: &Table{}, - }, - }) + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TableNameRef, + Selector: mg.Spec.ForProvider.TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TableName") } mg.Spec.ForProvider.TableName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TableNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TableNameRef, - Selector: mg.Spec.InitProvider.TableNameSelector, - To: reference.To{ - List: &TableList{}, - Managed: &Table{}, - }, - }) + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TableNameRef, + Selector: mg.Spec.InitProvider.TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TableName") } @@ -176,69 +259,106 @@ func (mg *TableItem) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this TableReplica. func (mg *TableReplica) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", + + "v1beta1", + + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalTableArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.GlobalTableArnRef, - Selector: mg.Spec.ForProvider.GlobalTableArnSelector, - To: reference.To{ - List: &TableList{}, - Managed: &Table{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalTableArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.GlobalTableArnRef, + Selector: mg.Spec.ForProvider.GlobalTableArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalTableArn") } mg.Spec.ForProvider.GlobalTableArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalTableArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("dynamodb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalTableArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.GlobalTableArnRef, - Selector: mg.Spec.InitProvider.GlobalTableArnSelector, - To: reference.To{ - List: &TableList{}, - Managed: &Table{}, - }, - }) + "Table", + "TableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalTableArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.GlobalTableArnRef, + Selector: mg.Spec.InitProvider.GlobalTableArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GlobalTableArn") } mg.Spec.InitProvider.GlobalTableArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GlobalTableArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } diff --git a/apis/ec2/v1beta1/zz_generated.resolvers.go b/apis/ec2/v1beta1/zz_generated.resolvers.go index 1d315ae7ea..38db1fa5d0 100644 --- a/apis/ec2/v1beta1/zz_generated.resolvers.go +++ b/apis/ec2/v1beta1/zz_generated.resolvers.go @@ -10,32 +10,45 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AMI. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this AMI. func (mg *AMI) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.EBSBlockDevice); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EBSBlockDevice[i3].SnapshotID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EBSBlockDevice[i3].SnapshotIDRef, - Selector: mg.Spec.ForProvider.EBSBlockDevice[i3].SnapshotIDSelector, - To: reference.To{ - List: &EBSSnapshotList{}, - Managed: &EBSSnapshot{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EBSSnapshot", + "EBSSnapshotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EBSBlockDevice[i3].SnapshotID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EBSBlockDevice[i3].SnapshotIDRef, + Selector: mg.Spec.ForProvider.EBSBlockDevice[i3].SnapshotIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EBSBlockDevice[i3].SnapshotID") } @@ -44,16 +57,26 @@ func (mg *AMI) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.InitProvider.EBSBlockDevice); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EBSBlockDevice[i3].SnapshotID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EBSBlockDevice[i3].SnapshotIDRef, - Selector: mg.Spec.InitProvider.EBSBlockDevice[i3].SnapshotIDSelector, - To: reference.To{ - List: &EBSSnapshotList{}, - Managed: &EBSSnapshot{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EBSSnapshot", + "EBSSnapshotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EBSBlockDevice[i3].SnapshotID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EBSBlockDevice[i3].SnapshotIDRef, + Selector: mg.Spec.InitProvider.EBSBlockDevice[i3].SnapshotIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EBSBlockDevice[i3].SnapshotID") } @@ -67,69 +90,104 @@ func (mg *AMI) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this AMICopy. func (mg *AMICopy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "AMI", "AMIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceAMIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SourceAMIIDRef, - Selector: mg.Spec.ForProvider.SourceAMIIDSelector, - To: reference.To{ - List: &AMIList{}, - Managed: &AMI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceAMIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SourceAMIIDRef, + Selector: mg.Spec.ForProvider.SourceAMIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceAMIID") } mg.Spec.ForProvider.SourceAMIID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceAMIIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "AMI", "AMIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceAMIID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SourceAMIIDRef, - Selector: mg.Spec.InitProvider.SourceAMIIDSelector, - To: reference.To{ - List: &AMIList{}, - Managed: &AMI{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceAMIID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SourceAMIIDRef, + Selector: mg.Spec.InitProvider.SourceAMIIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceAMIID") } @@ -141,37 +199,56 @@ func (mg *AMICopy) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this AMILaunchPermission. func (mg *AMILaunchPermission) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ImageID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ImageIDRef, - Selector: mg.Spec.ForProvider.ImageIDSelector, - To: reference.To{ - List: &AMIList{}, - Managed: &AMI{}, - }, - }) + "AMI", "AMIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ImageID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ImageIDRef, + Selector: mg.Spec.ForProvider.ImageIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ImageID") } mg.Spec.ForProvider.ImageID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ImageIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ImageID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ImageIDRef, - Selector: mg.Spec.InitProvider.ImageIDSelector, - To: reference.To{ - List: &AMIList{}, - Managed: &AMI{}, - }, - }) + "AMI", "AMIList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ImageID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ImageIDRef, + Selector: mg.Spec.InitProvider.ImageIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ImageID") } @@ -183,37 +260,56 @@ func (mg *AMILaunchPermission) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this CarrierGateway. func (mg *CarrierGateway) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -225,22 +321,33 @@ func (mg *CarrierGateway) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this DefaultNetworkACL. func (mg *DefaultNetworkACL) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultNetworkACLID), - Extract: resource.ExtractParamPath("default_network_acl_id", true), - Reference: mg.Spec.ForProvider.DefaultNetworkACLIDRef, - Selector: mg.Spec.ForProvider.DefaultNetworkACLIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultNetworkACLID), + Extract: resource.ExtractParamPath("default_network_acl_id", true), + Reference: mg.Spec.ForProvider.DefaultNetworkACLIDRef, + Selector: mg.Spec.ForProvider.DefaultNetworkACLIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultNetworkACLID") } @@ -248,16 +355,26 @@ func (mg *DefaultNetworkACL) ResolveReferences(ctx context.Context, c client.Rea mg.Spec.ForProvider.DefaultNetworkACLIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.Ingress); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Ingress[i3].CidrBlock), - Extract: resource.ExtractParamPath("cidr_block", true), - Reference: mg.Spec.ForProvider.Ingress[i3].CidrBlockRef, - Selector: mg.Spec.ForProvider.Ingress[i3].CidrBlockSelector, - To: reference.To{ - List: &DefaultVPCList{}, - Managed: &DefaultVPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "DefaultVPC", + "DefaultVPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Ingress[i3].CidrBlock), + Extract: resource.ExtractParamPath("cidr_block", true), + Reference: mg.Spec.ForProvider.Ingress[i3].CidrBlockRef, + Selector: mg.Spec.ForProvider.Ingress[i3].CidrBlockSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Ingress[i3].CidrBlock") } @@ -265,32 +382,50 @@ func (mg *DefaultNetworkACL) ResolveReferences(ctx context.Context, c client.Rea mg.Spec.ForProvider.Ingress[i3].CidrBlockRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultNetworkACLID), - Extract: resource.ExtractParamPath("default_network_acl_id", true), - Reference: mg.Spec.InitProvider.DefaultNetworkACLIDRef, - Selector: mg.Spec.InitProvider.DefaultNetworkACLIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultNetworkACLID), + Extract: resource.ExtractParamPath("default_network_acl_id", true), + Reference: mg.Spec.InitProvider.DefaultNetworkACLIDRef, + Selector: mg.Spec.InitProvider.DefaultNetworkACLIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultNetworkACLID") } @@ -298,16 +433,26 @@ func (mg *DefaultNetworkACL) ResolveReferences(ctx context.Context, c client.Rea mg.Spec.InitProvider.DefaultNetworkACLIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.Ingress); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Ingress[i3].CidrBlock), - Extract: resource.ExtractParamPath("cidr_block", true), - Reference: mg.Spec.InitProvider.Ingress[i3].CidrBlockRef, - Selector: mg.Spec.InitProvider.Ingress[i3].CidrBlockSelector, - To: reference.To{ - List: &DefaultVPCList{}, - Managed: &DefaultVPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "DefaultVPC", + "DefaultVPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Ingress[i3].CidrBlock), + Extract: resource.ExtractParamPath("cidr_block", true), + Reference: mg.Spec.InitProvider.Ingress[i3].CidrBlockRef, + Selector: mg.Spec.InitProvider.Ingress[i3].CidrBlockSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Ingress[i3].CidrBlock") } @@ -315,16 +460,26 @@ func (mg *DefaultNetworkACL) ResolveReferences(ctx context.Context, c client.Rea mg.Spec.InitProvider.Ingress[i3].CidrBlockRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } @@ -336,21 +491,32 @@ func (mg *DefaultNetworkACL) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this DefaultRouteTable. func (mg *DefaultRouteTable) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultRouteTableID), - Extract: resource.ExtractParamPath("default_route_table_id", true), - Reference: mg.Spec.ForProvider.DefaultRouteTableIDRef, - Selector: mg.Spec.ForProvider.DefaultRouteTableIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultRouteTableID), + Extract: resource.ExtractParamPath("default_route_table_id", true), + Reference: mg.Spec.ForProvider.DefaultRouteTableIDRef, + Selector: mg.Spec.ForProvider.DefaultRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultRouteTableID") } @@ -358,16 +524,26 @@ func (mg *DefaultRouteTable) ResolveReferences(ctx context.Context, c client.Rea mg.Spec.ForProvider.DefaultRouteTableIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.Route); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Route[i3].EgressOnlyGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Route[i3].EgressOnlyGatewayIDRef, - Selector: mg.Spec.ForProvider.Route[i3].EgressOnlyGatewayIDSelector, - To: reference.To{ - List: &EgressOnlyInternetGatewayList{}, - Managed: &EgressOnlyInternetGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EgressOnlyInternetGateway", + + "EgressOnlyInternetGatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Route[i3].EgressOnlyGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Route[i3].EgressOnlyGatewayIDRef, + Selector: mg.Spec.ForProvider.Route[i3].EgressOnlyGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Route[i3].EgressOnlyGatewayID") } @@ -376,16 +552,27 @@ func (mg *DefaultRouteTable) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.ForProvider.Route); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Route[i3].GatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Route[i3].GatewayIDRef, - Selector: mg.Spec.ForProvider.Route[i3].GatewayIDSelector, - To: reference.To{ - List: &InternetGatewayList{}, - Managed: &InternetGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "InternetGateway", + + "InternetGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Route[i3].GatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Route[i3].GatewayIDRef, + Selector: mg.Spec.ForProvider.Route[i3].GatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Route[i3].GatewayID") } @@ -393,16 +580,25 @@ func (mg *DefaultRouteTable) ResolveReferences(ctx context.Context, c client.Rea mg.Spec.ForProvider.Route[i3].GatewayIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultRouteTableID), - Extract: resource.ExtractParamPath("default_route_table_id", true), - Reference: mg.Spec.InitProvider.DefaultRouteTableIDRef, - Selector: mg.Spec.InitProvider.DefaultRouteTableIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultRouteTableID), + Extract: resource.ExtractParamPath("default_route_table_id", true), + Reference: mg.Spec.InitProvider.DefaultRouteTableIDRef, + Selector: mg.Spec.InitProvider.DefaultRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultRouteTableID") } @@ -410,16 +606,26 @@ func (mg *DefaultRouteTable) ResolveReferences(ctx context.Context, c client.Rea mg.Spec.InitProvider.DefaultRouteTableIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.Route); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Route[i3].EgressOnlyGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Route[i3].EgressOnlyGatewayIDRef, - Selector: mg.Spec.InitProvider.Route[i3].EgressOnlyGatewayIDSelector, - To: reference.To{ - List: &EgressOnlyInternetGatewayList{}, - Managed: &EgressOnlyInternetGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EgressOnlyInternetGateway", + + "EgressOnlyInternetGatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Route[i3].EgressOnlyGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Route[i3].EgressOnlyGatewayIDRef, + Selector: mg.Spec.InitProvider.Route[i3].EgressOnlyGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Route[i3].EgressOnlyGatewayID") } @@ -428,16 +634,27 @@ func (mg *DefaultRouteTable) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.InitProvider.Route); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Route[i3].GatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Route[i3].GatewayIDRef, - Selector: mg.Spec.InitProvider.Route[i3].GatewayIDSelector, - To: reference.To{ - List: &InternetGatewayList{}, - Managed: &InternetGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "InternetGateway", + + "InternetGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Route[i3].GatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Route[i3].GatewayIDRef, + Selector: mg.Spec.InitProvider.Route[i3].GatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Route[i3].GatewayID") } @@ -451,37 +668,56 @@ func (mg *DefaultRouteTable) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this DefaultSecurityGroup. func (mg *DefaultSecurityGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -493,37 +729,56 @@ func (mg *DefaultSecurityGroup) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this EBSDefaultKMSKey. func (mg *EBSDefaultKMSKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.KeyArnRef, - Selector: mg.Spec.ForProvider.KeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.KeyArnRef, + Selector: mg.Spec.ForProvider.KeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KeyArn") } mg.Spec.ForProvider.KeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.KeyArnRef, - Selector: mg.Spec.InitProvider.KeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.KeyArnRef, + Selector: mg.Spec.InitProvider.KeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KeyArn") } @@ -535,37 +790,58 @@ func (mg *EBSDefaultKMSKey) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this EBSSnapshot. func (mg *EBSSnapshot) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VolumeID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VolumeIDRef, - Selector: mg.Spec.ForProvider.VolumeIDSelector, - To: reference.To{ - List: &EBSVolumeList{}, - Managed: &EBSVolume{}, - }, - }) + "v1beta1", + + "EBSVolume", + "EBSVolumeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VolumeID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VolumeIDRef, + Selector: mg.Spec.ForProvider.VolumeIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VolumeID") } mg.Spec.ForProvider.VolumeID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VolumeIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VolumeID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VolumeIDRef, - Selector: mg.Spec.InitProvider.VolumeIDSelector, - To: reference.To{ - List: &EBSVolumeList{}, - Managed: &EBSVolume{}, - }, - }) + "v1beta1", + + "EBSVolume", + "EBSVolumeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VolumeID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VolumeIDRef, + Selector: mg.Spec.InitProvider.VolumeIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VolumeID") } @@ -577,69 +853,106 @@ func (mg *EBSSnapshot) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this EBSSnapshotCopy. func (mg *EBSSnapshotCopy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EBSSnapshot", + "EBSSnapshotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceSnapshotID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SourceSnapshotIDRef, - Selector: mg.Spec.ForProvider.SourceSnapshotIDSelector, - To: reference.To{ - List: &EBSSnapshotList{}, - Managed: &EBSSnapshot{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceSnapshotID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SourceSnapshotIDRef, + Selector: mg.Spec.ForProvider.SourceSnapshotIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceSnapshotID") } mg.Spec.ForProvider.SourceSnapshotID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceSnapshotIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EBSSnapshot", + "EBSSnapshotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceSnapshotID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SourceSnapshotIDRef, - Selector: mg.Spec.InitProvider.SourceSnapshotIDSelector, - To: reference.To{ - List: &EBSSnapshotList{}, - Managed: &EBSSnapshot{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceSnapshotID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SourceSnapshotIDRef, + Selector: mg.Spec.InitProvider.SourceSnapshotIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceSnapshotID") } @@ -651,37 +964,56 @@ func (mg *EBSSnapshotCopy) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this EBSSnapshotImport. func (mg *EBSSnapshotImport) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -693,37 +1025,56 @@ func (mg *EBSSnapshotImport) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this EBSVolume. func (mg *EBSVolume) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -735,69 +1086,110 @@ func (mg *EBSVolume) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this EIP. func (mg *EIP) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Instance), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.InstanceRef, - Selector: mg.Spec.ForProvider.InstanceSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Instance), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.InstanceRef, + Selector: mg.Spec.ForProvider.InstanceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Instance") } mg.Spec.ForProvider.Instance = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterface), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NetworkInterfaceRef, - Selector: mg.Spec.ForProvider.NetworkInterfaceSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterface), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NetworkInterfaceRef, + Selector: mg.Spec.ForProvider.NetworkInterfaceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterface") } mg.Spec.ForProvider.NetworkInterface = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NetworkInterfaceRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Instance), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.InstanceRef, - Selector: mg.Spec.InitProvider.InstanceSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Instance), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.InstanceRef, + Selector: mg.Spec.InitProvider.InstanceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Instance") } mg.Spec.InitProvider.Instance = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.InstanceRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterface), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NetworkInterfaceRef, - Selector: mg.Spec.InitProvider.NetworkInterfaceSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterface), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NetworkInterfaceRef, + Selector: mg.Spec.InitProvider.NetworkInterfaceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterface") } @@ -809,69 +1201,106 @@ func (mg *EIP) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this EIPAssociation. func (mg *EIPAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AllocationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AllocationIDRef, - Selector: mg.Spec.ForProvider.AllocationIDSelector, - To: reference.To{ - List: &EIPList{}, - Managed: &EIP{}, - }, - }) + "EIP", "EIPList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AllocationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AllocationIDRef, + Selector: mg.Spec.ForProvider.AllocationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AllocationID") } mg.Spec.ForProvider.AllocationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AllocationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AllocationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.AllocationIDRef, - Selector: mg.Spec.InitProvider.AllocationIDSelector, - To: reference.To{ - List: &EIPList{}, - Managed: &EIP{}, - }, - }) + "EIP", "EIPList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AllocationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.AllocationIDRef, + Selector: mg.Spec.InitProvider.AllocationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AllocationID") } mg.Spec.InitProvider.AllocationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AllocationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -883,37 +1312,56 @@ func (mg *EIPAssociation) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this EgressOnlyInternetGateway. func (mg *EgressOnlyInternetGateway) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -925,133 +1373,208 @@ func (mg *EgressOnlyInternetGateway) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this FlowLog. func (mg *FlowLog) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMRoleArnRef, - Selector: mg.Spec.ForProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMRoleArnRef, + Selector: mg.Spec.ForProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoleArn") } mg.Spec.ForProvider.IAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogDestination), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.LogDestinationRef, - Selector: mg.Spec.ForProvider.LogDestinationSelector, - To: reference.To{ - List: &v1beta12.GroupList{}, - Managed: &v1beta12.Group{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogDestination), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.LogDestinationRef, + Selector: mg.Spec.ForProvider.LogDestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LogDestination") } mg.Spec.ForProvider.LogDestination = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LogDestinationRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMRoleArnRef, - Selector: mg.Spec.InitProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMRoleArnRef, + Selector: mg.Spec.InitProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoleArn") } mg.Spec.InitProvider.IAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogDestination), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.LogDestinationRef, - Selector: mg.Spec.InitProvider.LogDestinationSelector, - To: reference.To{ - List: &v1beta12.GroupList{}, - Managed: &v1beta12.Group{}, - }, - }) + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogDestination), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.LogDestinationRef, + Selector: mg.Spec.InitProvider.LogDestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LogDestination") } mg.Spec.InitProvider.LogDestination = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.LogDestinationRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } mg.Spec.InitProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -1063,6 +1586,9 @@ func (mg *FlowLog) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Instance. func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -1070,16 +1596,25 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.EBSBlockDevice); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EBSBlockDevice[i3].KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EBSBlockDevice[i3].KMSKeyIDRef, - Selector: mg.Spec.ForProvider.EBSBlockDevice[i3].KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EBSBlockDevice[i3].KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EBSBlockDevice[i3].KMSKeyIDRef, + Selector: mg.Spec.ForProvider.EBSBlockDevice[i3].KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EBSBlockDevice[i3].KMSKeyID") } @@ -1088,16 +1623,27 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.NetworkInterface); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterface[i3].NetworkInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NetworkInterface[i3].NetworkInterfaceIDRef, - Selector: mg.Spec.ForProvider.NetworkInterface[i3].NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterface[i3].NetworkInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NetworkInterface[i3].NetworkInterfaceIDRef, + Selector: mg.Spec.ForProvider.NetworkInterface[i3].NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterface[i3].NetworkInterfaceID") } @@ -1106,49 +1652,77 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.RootBlockDevice); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyIDRef, - Selector: mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) - if err != nil { - return errors.Wrap(err, "mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyID") + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyIDRef, + Selector: mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyID") } mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RootBlockDevice[i3].KMSKeyIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } @@ -1156,16 +1730,25 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.InitProvider.EBSBlockDevice); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EBSBlockDevice[i3].KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EBSBlockDevice[i3].KMSKeyIDRef, - Selector: mg.Spec.InitProvider.EBSBlockDevice[i3].KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EBSBlockDevice[i3].KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EBSBlockDevice[i3].KMSKeyIDRef, + Selector: mg.Spec.InitProvider.EBSBlockDevice[i3].KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EBSBlockDevice[i3].KMSKeyID") } @@ -1174,16 +1757,27 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.NetworkInterface); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterface[i3].NetworkInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NetworkInterface[i3].NetworkInterfaceIDRef, - Selector: mg.Spec.InitProvider.NetworkInterface[i3].NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterface[i3].NetworkInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NetworkInterface[i3].NetworkInterfaceIDRef, + Selector: mg.Spec.InitProvider.NetworkInterface[i3].NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterface[i3].NetworkInterfaceID") } @@ -1192,16 +1786,25 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.RootBlockDevice); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RootBlockDevice[i3].KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RootBlockDevice[i3].KMSKeyIDRef, - Selector: mg.Spec.InitProvider.RootBlockDevice[i3].KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RootBlockDevice[i3].KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RootBlockDevice[i3].KMSKeyIDRef, + Selector: mg.Spec.InitProvider.RootBlockDevice[i3].KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RootBlockDevice[i3].KMSKeyID") } @@ -1209,32 +1812,51 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.RootBlockDevice[i3].KMSKeyIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } mg.Spec.InitProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -1246,37 +1868,58 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this InstanceState. func (mg *InstanceState) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } @@ -1288,37 +1931,56 @@ func (mg *InstanceState) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this InternetGateway. func (mg *InternetGateway) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -1330,6 +1992,9 @@ func (mg *InternetGateway) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this LaunchTemplate. func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -1338,16 +2003,25 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.ForProvider.BlockDeviceMappings); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.BlockDeviceMappings[i3].EBS); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyIDRef, - Selector: mg.Spec.ForProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyIDRef, + Selector: mg.Spec.ForProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyID") } @@ -1357,16 +2031,27 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.ForProvider.IAMInstanceProfile); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMInstanceProfile[i3].Arn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMInstanceProfile[i3].ArnRef, - Selector: mg.Spec.ForProvider.IAMInstanceProfile[i3].ArnSelector, - To: reference.To{ - List: &v1beta11.InstanceProfileList{}, - Managed: &v1beta11.InstanceProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", + + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMInstanceProfile[i3].Arn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMInstanceProfile[i3].ArnRef, + Selector: mg.Spec.ForProvider.IAMInstanceProfile[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMInstanceProfile[i3].Arn") } @@ -1375,16 +2060,27 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.IAMInstanceProfile); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMInstanceProfile[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.IAMInstanceProfile[i3].NameRef, - Selector: mg.Spec.ForProvider.IAMInstanceProfile[i3].NameSelector, - To: reference.To{ - List: &v1beta11.InstanceProfileList{}, - Managed: &v1beta11.InstanceProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", + + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMInstanceProfile[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.IAMInstanceProfile[i3].NameRef, + Selector: mg.Spec.ForProvider.IAMInstanceProfile[i3].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMInstanceProfile[i3].Name") } @@ -1393,16 +2089,27 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.NetworkInterfaces); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaces[i3].NetworkInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NetworkInterfaces[i3].NetworkInterfaceIDRef, - Selector: mg.Spec.ForProvider.NetworkInterfaces[i3].NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaces[i3].NetworkInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NetworkInterfaces[i3].NetworkInterfaceIDRef, + Selector: mg.Spec.ForProvider.NetworkInterfaces[i3].NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterfaces[i3].NetworkInterfaceID") } @@ -1411,16 +2118,26 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.NetworkInterfaces); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.NetworkInterfaces[i3].SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.NetworkInterfaces[i3].SecurityGroupRefs, - Selector: mg.Spec.ForProvider.NetworkInterfaces[i3].SecurityGroupSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.NetworkInterfaces[i3].SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.NetworkInterfaces[i3].SecurityGroupRefs, + Selector: mg.Spec.ForProvider.NetworkInterfaces[i3].SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterfaces[i3].SecurityGroups") } @@ -1429,16 +2146,26 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.NetworkInterfaces); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaces[i3].SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NetworkInterfaces[i3].SubnetIDRef, - Selector: mg.Spec.ForProvider.NetworkInterfaces[i3].SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaces[i3].SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NetworkInterfaces[i3].SubnetIDRef, + Selector: mg.Spec.ForProvider.NetworkInterfaces[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterfaces[i3].SubnetID") } @@ -1446,32 +2173,51 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader mg.Spec.ForProvider.NetworkInterfaces[i3].SubnetIDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupNames), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupNameRefs, - Selector: mg.Spec.ForProvider.SecurityGroupNameSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupNames), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupNameRefs, + Selector: mg.Spec.ForProvider.SecurityGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupNames") } mg.Spec.ForProvider.SecurityGroupNames = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupNameRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } @@ -1480,16 +2226,25 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.InitProvider.BlockDeviceMappings); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.BlockDeviceMappings[i3].EBS); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyIDRef, - Selector: mg.Spec.InitProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyIDRef, + Selector: mg.Spec.InitProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BlockDeviceMappings[i3].EBS[i4].KMSKeyID") } @@ -1499,16 +2254,27 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.InitProvider.IAMInstanceProfile); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMInstanceProfile[i3].Arn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMInstanceProfile[i3].ArnRef, - Selector: mg.Spec.InitProvider.IAMInstanceProfile[i3].ArnSelector, - To: reference.To{ - List: &v1beta11.InstanceProfileList{}, - Managed: &v1beta11.InstanceProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", + + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMInstanceProfile[i3].Arn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMInstanceProfile[i3].ArnRef, + Selector: mg.Spec.InitProvider.IAMInstanceProfile[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMInstanceProfile[i3].Arn") } @@ -1517,16 +2283,27 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.IAMInstanceProfile); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMInstanceProfile[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.IAMInstanceProfile[i3].NameRef, - Selector: mg.Spec.InitProvider.IAMInstanceProfile[i3].NameSelector, - To: reference.To{ - List: &v1beta11.InstanceProfileList{}, - Managed: &v1beta11.InstanceProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", + + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMInstanceProfile[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.IAMInstanceProfile[i3].NameRef, + Selector: mg.Spec.InitProvider.IAMInstanceProfile[i3].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMInstanceProfile[i3].Name") } @@ -1535,16 +2312,27 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.NetworkInterfaces); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaces[i3].NetworkInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NetworkInterfaces[i3].NetworkInterfaceIDRef, - Selector: mg.Spec.InitProvider.NetworkInterfaces[i3].NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaces[i3].NetworkInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NetworkInterfaces[i3].NetworkInterfaceIDRef, + Selector: mg.Spec.InitProvider.NetworkInterfaces[i3].NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterfaces[i3].NetworkInterfaceID") } @@ -1553,16 +2341,26 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.NetworkInterfaces); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.NetworkInterfaces[i3].SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.NetworkInterfaces[i3].SecurityGroupRefs, - Selector: mg.Spec.InitProvider.NetworkInterfaces[i3].SecurityGroupSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.NetworkInterfaces[i3].SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.NetworkInterfaces[i3].SecurityGroupRefs, + Selector: mg.Spec.InitProvider.NetworkInterfaces[i3].SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterfaces[i3].SecurityGroups") } @@ -1571,16 +2369,26 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.NetworkInterfaces); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaces[i3].SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NetworkInterfaces[i3].SubnetIDRef, - Selector: mg.Spec.InitProvider.NetworkInterfaces[i3].SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaces[i3].SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NetworkInterfaces[i3].SubnetIDRef, + Selector: mg.Spec.InitProvider.NetworkInterfaces[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterfaces[i3].SubnetID") } @@ -1588,32 +2396,51 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader mg.Spec.InitProvider.NetworkInterfaces[i3].SubnetIDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupNames), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupNameRefs, - Selector: mg.Spec.InitProvider.SecurityGroupNameSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) - if err != nil { - return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupNames") + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupNames), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupNameRefs, + Selector: mg.Spec.InitProvider.SecurityGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupNames") } mg.Spec.InitProvider.SecurityGroupNames = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupNameRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -1625,69 +2452,106 @@ func (mg *LaunchTemplate) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this MainRouteTableAssociation. func (mg *MainRouteTableAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RouteTableIDRef, - Selector: mg.Spec.ForProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RouteTableIDRef, + Selector: mg.Spec.ForProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RouteTableID") } mg.Spec.ForProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RouteTableIDRef, - Selector: mg.Spec.InitProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RouteTableIDRef, + Selector: mg.Spec.InitProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RouteTableID") } mg.Spec.InitProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -1699,22 +2563,36 @@ func (mg *MainRouteTableAssociation) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this ManagedPrefixList. func (mg *ManagedPrefixList) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Entry); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Entry[i3].Cidr), - Extract: resource.ExtractParamPath("cidr_block", false), - Reference: mg.Spec.ForProvider.Entry[i3].CidrRef, - Selector: mg.Spec.ForProvider.Entry[i3].CidrSelector, - To: reference.To{ - List: &VPCIPv4CidrBlockAssociationList{}, - Managed: &VPCIPv4CidrBlockAssociation{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIPv4CidrBlockAssociation", + + "VPCIPv4CidrBlockAssociationList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Entry[i3].Cidr), + Extract: resource.ExtractParamPath("cidr_block", false), + Reference: mg.Spec.ForProvider.Entry[i3].CidrRef, + Selector: mg.Spec.ForProvider.Entry[i3].CidrSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Entry[i3].Cidr") } @@ -1723,16 +2601,27 @@ func (mg *ManagedPrefixList) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.InitProvider.Entry); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Entry[i3].Cidr), - Extract: resource.ExtractParamPath("cidr_block", false), - Reference: mg.Spec.InitProvider.Entry[i3].CidrRef, - Selector: mg.Spec.InitProvider.Entry[i3].CidrSelector, - To: reference.To{ - List: &VPCIPv4CidrBlockAssociationList{}, - Managed: &VPCIPv4CidrBlockAssociation{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIPv4CidrBlockAssociation", + + "VPCIPv4CidrBlockAssociationList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Entry[i3].Cidr), + Extract: resource.ExtractParamPath("cidr_block", false), + Reference: mg.Spec.InitProvider.Entry[i3].CidrRef, + Selector: mg.Spec.InitProvider.Entry[i3].CidrSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Entry[i3].Cidr") } @@ -1746,69 +2635,106 @@ func (mg *ManagedPrefixList) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this ManagedPrefixListEntry. func (mg *ManagedPrefixListEntry) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Cidr), - Extract: resource.ExtractParamPath("cidr_block", false), - Reference: mg.Spec.ForProvider.CidrRef, - Selector: mg.Spec.ForProvider.CidrSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Cidr), + Extract: resource.ExtractParamPath("cidr_block", false), + Reference: mg.Spec.ForProvider.CidrRef, + Selector: mg.Spec.ForProvider.CidrSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Cidr") } mg.Spec.ForProvider.Cidr = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CidrRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrefixListID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PrefixListIDRef, - Selector: mg.Spec.ForProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrefixListID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PrefixListIDRef, + Selector: mg.Spec.ForProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrefixListID") } mg.Spec.ForProvider.PrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Cidr), - Extract: resource.ExtractParamPath("cidr_block", false), - Reference: mg.Spec.InitProvider.CidrRef, - Selector: mg.Spec.InitProvider.CidrSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Cidr), + Extract: resource.ExtractParamPath("cidr_block", false), + Reference: mg.Spec.InitProvider.CidrRef, + Selector: mg.Spec.InitProvider.CidrSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Cidr") } mg.Spec.InitProvider.Cidr = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CidrRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrefixListID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PrefixListIDRef, - Selector: mg.Spec.InitProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrefixListID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PrefixListIDRef, + Selector: mg.Spec.InitProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PrefixListID") } @@ -1820,69 +2746,106 @@ func (mg *ManagedPrefixListEntry) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this NATGateway. func (mg *NATGateway) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EIP", "EIPList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AllocationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AllocationIDRef, - Selector: mg.Spec.ForProvider.AllocationIDSelector, - To: reference.To{ - List: &EIPList{}, - Managed: &EIP{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AllocationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AllocationIDRef, + Selector: mg.Spec.ForProvider.AllocationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AllocationID") } mg.Spec.ForProvider.AllocationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AllocationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EIP", "EIPList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AllocationID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.AllocationIDRef, - Selector: mg.Spec.InitProvider.AllocationIDSelector, - To: reference.To{ - List: &EIPList{}, - Managed: &EIP{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AllocationID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.AllocationIDRef, + Selector: mg.Spec.InitProvider.AllocationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AllocationID") } mg.Spec.InitProvider.AllocationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AllocationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } @@ -1894,70 +2857,107 @@ func (mg *NATGateway) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this NetworkACL. func (mg *NetworkACL) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } mg.Spec.InitProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -1969,37 +2969,58 @@ func (mg *NetworkACL) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this NetworkACLRule. func (mg *NetworkACLRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkACLID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.NetworkACLIDRef, - Selector: mg.Spec.ForProvider.NetworkACLIDSelector, - To: reference.To{ - List: &NetworkACLList{}, - Managed: &NetworkACL{}, - }, - }) + "NetworkACL", + "NetworkACLList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkACLID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.NetworkACLIDRef, + Selector: mg.Spec.ForProvider.NetworkACLIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkACLID") } mg.Spec.ForProvider.NetworkACLID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NetworkACLIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkACLID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.NetworkACLIDRef, - Selector: mg.Spec.InitProvider.NetworkACLIDSelector, - To: reference.To{ - List: &NetworkACLList{}, - Managed: &NetworkACL{}, - }, - }) + "NetworkACL", + "NetworkACLList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkACLID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.NetworkACLIDRef, + Selector: mg.Spec.InitProvider.NetworkACLIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkACLID") } @@ -2011,37 +3032,58 @@ func (mg *NetworkACLRule) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this NetworkInsightsAnalysis. func (mg *NetworkInsightsAnalysis) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInsightsPath", + + "NetworkInsightsPathList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInsightsPathID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.NetworkInsightsPathIDRef, - Selector: mg.Spec.ForProvider.NetworkInsightsPathIDSelector, - To: reference.To{ - List: &NetworkInsightsPathList{}, - Managed: &NetworkInsightsPath{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInsightsPathID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.NetworkInsightsPathIDRef, + Selector: mg.Spec.ForProvider.NetworkInsightsPathIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInsightsPathID") } mg.Spec.ForProvider.NetworkInsightsPathID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NetworkInsightsPathIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInsightsPath", + + "NetworkInsightsPathList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInsightsPathID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.NetworkInsightsPathIDRef, - Selector: mg.Spec.InitProvider.NetworkInsightsPathIDSelector, - To: reference.To{ - List: &NetworkInsightsPathList{}, - Managed: &NetworkInsightsPath{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInsightsPathID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.NetworkInsightsPathIDRef, + Selector: mg.Spec.InitProvider.NetworkInsightsPathIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInsightsPathID") } @@ -2053,69 +3095,112 @@ func (mg *NetworkInsightsAnalysis) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this NetworkInsightsPath. func (mg *NetworkInsightsPath) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Destination), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DestinationRef, - Selector: mg.Spec.ForProvider.DestinationSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Destination), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DestinationRef, + Selector: mg.Spec.ForProvider.DestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Destination") } mg.Spec.ForProvider.Destination = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DestinationRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Source), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SourceRef, - Selector: mg.Spec.ForProvider.SourceSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Source), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SourceRef, + Selector: mg.Spec.ForProvider.SourceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Source") } mg.Spec.ForProvider.Source = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Destination), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DestinationRef, - Selector: mg.Spec.InitProvider.DestinationSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Destination), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DestinationRef, + Selector: mg.Spec.InitProvider.DestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Destination") } mg.Spec.InitProvider.Destination = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DestinationRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Source), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SourceRef, - Selector: mg.Spec.InitProvider.SourceSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Source), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SourceRef, + Selector: mg.Spec.InitProvider.SourceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Source") } @@ -2127,70 +3212,109 @@ func (mg *NetworkInsightsPath) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this NetworkInterface. func (mg *NetworkInterface) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupRefs, - Selector: mg.Spec.ForProvider.SecurityGroupSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupRefs, + Selector: mg.Spec.ForProvider.SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroups") } mg.Spec.ForProvider.SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupRefs, - Selector: mg.Spec.InitProvider.SecurityGroupSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupRefs, + Selector: mg.Spec.InitProvider.SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroups") } mg.Spec.InitProvider.SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } @@ -2202,69 +3326,110 @@ func (mg *NetworkInterface) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this NetworkInterfaceAttachment. func (mg *NetworkInterfaceAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterfaceID") } mg.Spec.ForProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } mg.Spec.InitProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterfaceID") } @@ -2276,69 +3441,108 @@ func (mg *NetworkInterfaceAttachment) ResolveReferences(ctx context.Context, c c // ResolveReferences of this NetworkInterfaceSgAttachment. func (mg *NetworkInterfaceSgAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), - Extract: resource.ExtractParamPath("primary_network_interface_id", true), - Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), + Extract: resource.ExtractParamPath("primary_network_interface_id", true), + Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterfaceID") } mg.Spec.ForProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SecurityGroupIDRef, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SecurityGroupIDRef, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupID") } mg.Spec.ForProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), - Extract: resource.ExtractParamPath("primary_network_interface_id", true), - Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), + Extract: resource.ExtractParamPath("primary_network_interface_id", true), + Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterfaceID") } mg.Spec.InitProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SecurityGroupIDRef, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SecurityGroupIDRef, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupID") } @@ -2350,293 +3554,464 @@ func (mg *NetworkInterfaceSgAttachment) ResolveReferences(ctx context.Context, c // ResolveReferences of this Route. func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationPrefixListID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DestinationPrefixListIDRef, - Selector: mg.Spec.ForProvider.DestinationPrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + "v1beta1", + + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationPrefixListID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DestinationPrefixListIDRef, + Selector: mg.Spec.ForProvider.DestinationPrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DestinationPrefixListID") } mg.Spec.ForProvider.DestinationPrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DestinationPrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "EgressOnlyInternetGateway", + + "EgressOnlyInternetGatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EgressOnlyGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.EgressOnlyGatewayIDRef, - Selector: mg.Spec.ForProvider.EgressOnlyGatewayIDSelector, - To: reference.To{ - List: &EgressOnlyInternetGatewayList{}, - Managed: &EgressOnlyInternetGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EgressOnlyGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.EgressOnlyGatewayIDRef, + Selector: mg.Spec.ForProvider.EgressOnlyGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EgressOnlyGatewayID") } mg.Spec.ForProvider.EgressOnlyGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EgressOnlyGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "InternetGateway", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.GatewayIDRef, - Selector: mg.Spec.ForProvider.GatewayIDSelector, - To: reference.To{ - List: &InternetGatewayList{}, - Managed: &InternetGateway{}, - }, - }) + "InternetGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.GatewayIDRef, + Selector: mg.Spec.ForProvider.GatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GatewayID") } mg.Spec.ForProvider.GatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NATGateway", + "NATGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NATGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NATGatewayIDRef, - Selector: mg.Spec.ForProvider.NATGatewayIDSelector, - To: reference.To{ - List: &NATGatewayList{}, - Managed: &NATGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NATGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NATGatewayIDRef, + Selector: mg.Spec.ForProvider.NATGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NATGatewayID") } mg.Spec.ForProvider.NATGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NATGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterfaceID") } mg.Spec.ForProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RouteTableIDRef, - Selector: mg.Spec.ForProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RouteTableIDRef, + Selector: mg.Spec.ForProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RouteTableID") } mg.Spec.ForProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayID") } mg.Spec.ForProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpoint", + "VPCEndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCEndpointIDRef, - Selector: mg.Spec.ForProvider.VPCEndpointIDSelector, - To: reference.To{ - List: &VPCEndpointList{}, - Managed: &VPCEndpoint{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCEndpointIDRef, + Selector: mg.Spec.ForProvider.VPCEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCEndpointID") } mg.Spec.ForProvider.VPCEndpointID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCEndpointIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCPeeringConnection", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCPeeringConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCPeeringConnectionIDRef, - Selector: mg.Spec.ForProvider.VPCPeeringConnectionIDSelector, - To: reference.To{ - List: &VPCPeeringConnectionList{}, - Managed: &VPCPeeringConnection{}, - }, - }) + "VPCPeeringConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCPeeringConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCPeeringConnectionIDRef, + Selector: mg.Spec.ForProvider.VPCPeeringConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCPeeringConnectionID") } mg.Spec.ForProvider.VPCPeeringConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCPeeringConnectionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationPrefixListID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DestinationPrefixListIDRef, - Selector: mg.Spec.InitProvider.DestinationPrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationPrefixListID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DestinationPrefixListIDRef, + Selector: mg.Spec.InitProvider.DestinationPrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DestinationPrefixListID") } mg.Spec.InitProvider.DestinationPrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DestinationPrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EgressOnlyGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.EgressOnlyGatewayIDRef, - Selector: mg.Spec.InitProvider.EgressOnlyGatewayIDSelector, - To: reference.To{ - List: &EgressOnlyInternetGatewayList{}, - Managed: &EgressOnlyInternetGateway{}, - }, - }) + "v1beta1", + + "EgressOnlyInternetGateway", + + "EgressOnlyInternetGatewayList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EgressOnlyGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.EgressOnlyGatewayIDRef, + Selector: mg.Spec.InitProvider.EgressOnlyGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EgressOnlyGatewayID") } mg.Spec.InitProvider.EgressOnlyGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.EgressOnlyGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "InternetGateway", + + "InternetGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.GatewayIDRef, - Selector: mg.Spec.InitProvider.GatewayIDSelector, - To: reference.To{ - List: &InternetGatewayList{}, - Managed: &InternetGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.GatewayIDRef, + Selector: mg.Spec.InitProvider.GatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GatewayID") } mg.Spec.InitProvider.GatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NATGateway", + "NATGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NATGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NATGatewayIDRef, - Selector: mg.Spec.InitProvider.NATGatewayIDSelector, - To: reference.To{ - List: &NATGatewayList{}, - Managed: &NATGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NATGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NATGatewayIDRef, + Selector: mg.Spec.InitProvider.NATGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NATGatewayID") } mg.Spec.InitProvider.NATGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.NATGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterfaceID") } mg.Spec.InitProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RouteTableIDRef, - Selector: mg.Spec.InitProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RouteTableIDRef, + Selector: mg.Spec.InitProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RouteTableID") } mg.Spec.InitProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayID") } mg.Spec.InitProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpoint", + "VPCEndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCEndpointIDRef, + Selector: mg.Spec.InitProvider.VPCEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.VPCEndpointID") + } + mg.Spec.InitProvider.VPCEndpointID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.VPCEndpointIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCPeeringConnection", + + "VPCPeeringConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCEndpointIDRef, - Selector: mg.Spec.InitProvider.VPCEndpointIDSelector, - To: reference.To{ - List: &VPCEndpointList{}, - Managed: &VPCEndpoint{}, - }, - }) - if err != nil { - return errors.Wrap(err, "mg.Spec.InitProvider.VPCEndpointID") + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCPeeringConnectionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCPeeringConnectionIDRef, + Selector: mg.Spec.InitProvider.VPCPeeringConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) } - mg.Spec.InitProvider.VPCEndpointID = reference.ToPtrValue(rsp.ResolvedValue) - mg.Spec.InitProvider.VPCEndpointIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCPeeringConnectionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCPeeringConnectionIDRef, - Selector: mg.Spec.InitProvider.VPCPeeringConnectionIDSelector, - To: reference.To{ - List: &VPCPeeringConnectionList{}, - Managed: &VPCPeeringConnection{}, - }, - }) if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCPeeringConnectionID") } @@ -2648,37 +4023,56 @@ func (mg *Route) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this RouteTable. func (mg *RouteTable) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -2690,101 +4084,160 @@ func (mg *RouteTable) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this RouteTableAssociation. func (mg *RouteTableAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "InternetGateway", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GatewayIDRef, - Selector: mg.Spec.ForProvider.GatewayIDSelector, - To: reference.To{ - List: &InternetGatewayList{}, - Managed: &InternetGateway{}, - }, - }) + "InternetGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GatewayIDRef, + Selector: mg.Spec.ForProvider.GatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GatewayID") } mg.Spec.ForProvider.GatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RouteTableIDRef, - Selector: mg.Spec.ForProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RouteTableIDRef, + Selector: mg.Spec.ForProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RouteTableID") } mg.Spec.ForProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "InternetGateway", + + "InternetGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.GatewayIDRef, - Selector: mg.Spec.InitProvider.GatewayIDSelector, - To: reference.To{ - List: &InternetGatewayList{}, - Managed: &InternetGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.GatewayIDRef, + Selector: mg.Spec.InitProvider.GatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GatewayID") } mg.Spec.InitProvider.GatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RouteTableIDRef, - Selector: mg.Spec.InitProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RouteTableIDRef, + Selector: mg.Spec.InitProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RouteTableID") } mg.Spec.InitProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } @@ -2796,37 +4249,56 @@ func (mg *RouteTableAssociation) ResolveReferences(ctx context.Context, c client // ResolveReferences of this SecurityGroup. func (mg *SecurityGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -2838,101 +4310,158 @@ func (mg *SecurityGroup) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this SecurityGroupEgressRule. func (mg *SecurityGroupEgressRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrefixListID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PrefixListIDRef, - Selector: mg.Spec.ForProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrefixListID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PrefixListIDRef, + Selector: mg.Spec.ForProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrefixListID") } mg.Spec.ForProvider.PrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReferencedSecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ReferencedSecurityGroupIDRef, - Selector: mg.Spec.ForProvider.ReferencedSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReferencedSecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ReferencedSecurityGroupIDRef, + Selector: mg.Spec.ForProvider.ReferencedSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ReferencedSecurityGroupID") } mg.Spec.ForProvider.ReferencedSecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ReferencedSecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SecurityGroupIDRef, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SecurityGroupIDRef, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupID") } mg.Spec.ForProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrefixListID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PrefixListIDRef, - Selector: mg.Spec.InitProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrefixListID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PrefixListIDRef, + Selector: mg.Spec.InitProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PrefixListID") } mg.Spec.InitProvider.PrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReferencedSecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ReferencedSecurityGroupIDRef, - Selector: mg.Spec.InitProvider.ReferencedSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReferencedSecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ReferencedSecurityGroupIDRef, + Selector: mg.Spec.InitProvider.ReferencedSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ReferencedSecurityGroupID") } mg.Spec.InitProvider.ReferencedSecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ReferencedSecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SecurityGroupIDRef, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SecurityGroupIDRef, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupID") } @@ -2944,101 +4473,158 @@ func (mg *SecurityGroupEgressRule) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this SecurityGroupIngressRule. func (mg *SecurityGroupIngressRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrefixListID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PrefixListIDRef, - Selector: mg.Spec.ForProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrefixListID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PrefixListIDRef, + Selector: mg.Spec.ForProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrefixListID") } mg.Spec.ForProvider.PrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReferencedSecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ReferencedSecurityGroupIDRef, - Selector: mg.Spec.ForProvider.ReferencedSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReferencedSecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ReferencedSecurityGroupIDRef, + Selector: mg.Spec.ForProvider.ReferencedSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ReferencedSecurityGroupID") } mg.Spec.ForProvider.ReferencedSecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ReferencedSecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SecurityGroupIDRef, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SecurityGroupIDRef, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupID") } mg.Spec.ForProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrefixListID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PrefixListIDRef, - Selector: mg.Spec.InitProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrefixListID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PrefixListIDRef, + Selector: mg.Spec.InitProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PrefixListID") } mg.Spec.InitProvider.PrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReferencedSecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ReferencedSecurityGroupIDRef, - Selector: mg.Spec.InitProvider.ReferencedSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReferencedSecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ReferencedSecurityGroupIDRef, + Selector: mg.Spec.InitProvider.ReferencedSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ReferencedSecurityGroupID") } mg.Spec.InitProvider.ReferencedSecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ReferencedSecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SecurityGroupIDRef, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SecurityGroupIDRef, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupID") } @@ -3050,102 +4636,159 @@ func (mg *SecurityGroupIngressRule) ResolveReferences(ctx context.Context, c cli // ResolveReferences of this SecurityGroupRule. func (mg *SecurityGroupRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.PrefixListIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.PrefixListIDRefs, - Selector: mg.Spec.ForProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.PrefixListIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.PrefixListIDRefs, + Selector: mg.Spec.ForProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrefixListIds") } mg.Spec.ForProvider.PrefixListIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.PrefixListIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SecurityGroupIDRef, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SecurityGroupIDRef, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupID") } mg.Spec.ForProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceSecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SourceSecurityGroupIDRef, - Selector: mg.Spec.ForProvider.SourceSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceSecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SourceSecurityGroupIDRef, + Selector: mg.Spec.ForProvider.SourceSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceSecurityGroupID") } mg.Spec.ForProvider.SourceSecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceSecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.PrefixListIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.PrefixListIDRefs, - Selector: mg.Spec.InitProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.PrefixListIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.PrefixListIDRefs, + Selector: mg.Spec.InitProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PrefixListIds") } mg.Spec.InitProvider.PrefixListIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.PrefixListIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SecurityGroupIDRef, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SecurityGroupIDRef, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupID") } mg.Spec.InitProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceSecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SourceSecurityGroupIDRef, - Selector: mg.Spec.InitProvider.SourceSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceSecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SourceSecurityGroupIDRef, + Selector: mg.Spec.InitProvider.SourceSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceSecurityGroupID") } @@ -3157,37 +4800,58 @@ func (mg *SecurityGroupRule) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this SnapshotCreateVolumePermission. func (mg *SnapshotCreateVolumePermission) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnapshotID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SnapshotIDRef, - Selector: mg.Spec.ForProvider.SnapshotIDSelector, - To: reference.To{ - List: &EBSSnapshotList{}, - Managed: &EBSSnapshot{}, - }, - }) + "EBSSnapshot", + "EBSSnapshotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnapshotID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SnapshotIDRef, + Selector: mg.Spec.ForProvider.SnapshotIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnapshotID") } mg.Spec.ForProvider.SnapshotID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnapshotIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnapshotID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SnapshotIDRef, - Selector: mg.Spec.InitProvider.SnapshotIDSelector, - To: reference.To{ - List: &EBSSnapshotList{}, - Managed: &EBSSnapshot{}, - }, - }) + "EBSSnapshot", + "EBSSnapshotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnapshotID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SnapshotIDRef, + Selector: mg.Spec.InitProvider.SnapshotIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnapshotID") } @@ -3199,22 +4863,36 @@ func (mg *SnapshotCreateVolumePermission) ResolveReferences(ctx context.Context, // ResolveReferences of this SpotFleetRequest. func (mg *SpotFleetRequest) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.LaunchSpecification); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchSpecification[i3].IAMInstanceProfileArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.LaunchSpecification[i3].IAMInstanceProfileArnRef, - Selector: mg.Spec.ForProvider.LaunchSpecification[i3].IAMInstanceProfileArnSelector, - To: reference.To{ - List: &v1beta11.InstanceProfileList{}, - Managed: &v1beta11.InstanceProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", + + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchSpecification[i3].IAMInstanceProfileArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.LaunchSpecification[i3].IAMInstanceProfileArnRef, + Selector: mg.Spec.ForProvider.LaunchSpecification[i3].IAMInstanceProfileArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LaunchSpecification[i3].IAMInstanceProfileArn") } @@ -3224,16 +4902,27 @@ func (mg *SpotFleetRequest) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.ForProvider.LaunchTemplateConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].ID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].IDRef, - Selector: mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].IDSelector, - To: reference.To{ - List: &LaunchTemplateList{}, - Managed: &LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].ID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].IDRef, + Selector: mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].IDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].ID") } @@ -3244,16 +4933,27 @@ func (mg *SpotFleetRequest) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.ForProvider.LaunchTemplateConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].Version), - Extract: resource.ExtractParamPath("latest_version", true), - Reference: mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].VersionRef, - Selector: mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].VersionSelector, - To: reference.To{ - List: &LaunchTemplateList{}, - Managed: &LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].Version), + Extract: resource.ExtractParamPath("latest_version", true), + Reference: mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].VersionRef, + Selector: mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].VersionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].Version") } @@ -3263,16 +4963,27 @@ func (mg *SpotFleetRequest) ResolveReferences(ctx context.Context, c client.Read } } for i3 := 0; i3 < len(mg.Spec.InitProvider.LaunchSpecification); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchSpecification[i3].IAMInstanceProfileArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.LaunchSpecification[i3].IAMInstanceProfileArnRef, - Selector: mg.Spec.InitProvider.LaunchSpecification[i3].IAMInstanceProfileArnSelector, - To: reference.To{ - List: &v1beta11.InstanceProfileList{}, - Managed: &v1beta11.InstanceProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", + + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchSpecification[i3].IAMInstanceProfileArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.LaunchSpecification[i3].IAMInstanceProfileArnRef, + Selector: mg.Spec.InitProvider.LaunchSpecification[i3].IAMInstanceProfileArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LaunchSpecification[i3].IAMInstanceProfileArn") } @@ -3282,16 +4993,27 @@ func (mg *SpotFleetRequest) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.InitProvider.LaunchTemplateConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].ID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].IDRef, - Selector: mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].IDSelector, - To: reference.To{ - List: &LaunchTemplateList{}, - Managed: &LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].ID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].IDRef, + Selector: mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].IDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].ID") } @@ -3302,16 +5024,27 @@ func (mg *SpotFleetRequest) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.InitProvider.LaunchTemplateConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].Version), - Extract: resource.ExtractParamPath("latest_version", true), - Reference: mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].VersionRef, - Selector: mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].VersionSelector, - To: reference.To{ - List: &LaunchTemplateList{}, - Managed: &LaunchTemplate{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "LaunchTemplate", + + "LaunchTemplateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].Version), + Extract: resource.ExtractParamPath("latest_version", true), + Reference: mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].VersionRef, + Selector: mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].VersionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LaunchTemplateConfig[i3].LaunchTemplateSpecification[i4].Version") } @@ -3326,70 +5059,109 @@ func (mg *SpotFleetRequest) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this SpotInstanceRequest. func (mg *SpotInstanceRequest) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } mg.Spec.InitProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -3401,37 +5173,56 @@ func (mg *SpotInstanceRequest) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this Subnet. func (mg *Subnet) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -3443,37 +5234,58 @@ func (mg *Subnet) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this SubnetCidrReservation. func (mg *SubnetCidrReservation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } @@ -3485,37 +5297,58 @@ func (mg *SubnetCidrReservation) ResolveReferences(ctx context.Context, c client // ResolveReferences of this TrafficMirrorFilterRule. func (mg *TrafficMirrorFilterRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TrafficMirrorFilter", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TrafficMirrorFilterID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TrafficMirrorFilterIDRef, - Selector: mg.Spec.ForProvider.TrafficMirrorFilterIDSelector, - To: reference.To{ - List: &TrafficMirrorFilterList{}, - Managed: &TrafficMirrorFilter{}, - }, - }) + "TrafficMirrorFilterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TrafficMirrorFilterID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TrafficMirrorFilterIDRef, + Selector: mg.Spec.ForProvider.TrafficMirrorFilterIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TrafficMirrorFilterID") } mg.Spec.ForProvider.TrafficMirrorFilterID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TrafficMirrorFilterIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TrafficMirrorFilter", + + "TrafficMirrorFilterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TrafficMirrorFilterID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TrafficMirrorFilterIDRef, - Selector: mg.Spec.InitProvider.TrafficMirrorFilterIDSelector, - To: reference.To{ - List: &TrafficMirrorFilterList{}, - Managed: &TrafficMirrorFilter{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TrafficMirrorFilterID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TrafficMirrorFilterIDRef, + Selector: mg.Spec.InitProvider.TrafficMirrorFilterIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TrafficMirrorFilterID") } @@ -3527,69 +5360,112 @@ func (mg *TrafficMirrorFilterRule) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this TransitGatewayConnect. func (mg *TransitGatewayConnect) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayID") } mg.Spec.ForProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransportAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransportAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransportAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransportAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransportAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransportAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransportAttachmentID") } mg.Spec.ForProvider.TransportAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransportAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayID") } mg.Spec.InitProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransportAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransportAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransportAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransportAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransportAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransportAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransportAttachmentID") } @@ -3601,37 +5477,62 @@ func (mg *TransitGatewayConnect) ResolveReferences(ctx context.Context, c client // ResolveReferences of this TransitGatewayConnectPeer. func (mg *TransitGatewayConnectPeer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayConnect", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayConnectList{}, - Managed: &TransitGatewayConnect{}, - }, - }) + "TransitGatewayConnectList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayAttachmentID") } mg.Spec.ForProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayConnect", + + "TransitGatewayConnectList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayConnectList{}, - Managed: &TransitGatewayConnect{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayAttachmentID") } @@ -3643,37 +5544,60 @@ func (mg *TransitGatewayConnectPeer) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this TransitGatewayMulticastDomain. func (mg *TransitGatewayMulticastDomain) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayID") } mg.Spec.ForProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayID") } @@ -3685,101 +5609,162 @@ func (mg *TransitGatewayMulticastDomain) ResolveReferences(ctx context.Context, // ResolveReferences of this TransitGatewayMulticastDomainAssociation. func (mg *TransitGatewayMulticastDomainAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayAttachmentID") } mg.Spec.ForProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayMulticastDomain", + + "TransitGatewayMulticastDomainList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayMulticastDomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDSelector, - To: reference.To{ - List: &TransitGatewayMulticastDomainList{}, - Managed: &TransitGatewayMulticastDomain{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayMulticastDomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayMulticastDomainID") } mg.Spec.ForProvider.TransitGatewayMulticastDomainID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } mg.Spec.InitProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayAttachmentID") } mg.Spec.InitProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayMulticastDomain", + + "TransitGatewayMulticastDomainList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayMulticastDomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDSelector, - To: reference.To{ - List: &TransitGatewayMulticastDomainList{}, - Managed: &TransitGatewayMulticastDomain{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayMulticastDomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayMulticastDomainID") } @@ -3791,69 +5776,112 @@ func (mg *TransitGatewayMulticastDomainAssociation) ResolveReferences(ctx contex // ResolveReferences of this TransitGatewayMulticastGroupMember. func (mg *TransitGatewayMulticastGroupMember) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterfaceID") } mg.Spec.ForProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayMulticastDomain", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayMulticastDomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDSelector, - To: reference.To{ - List: &TransitGatewayMulticastDomainList{}, - Managed: &TransitGatewayMulticastDomain{}, - }, - }) + "TransitGatewayMulticastDomainList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayMulticastDomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayMulticastDomainID") } mg.Spec.ForProvider.TransitGatewayMulticastDomainID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterfaceID") } mg.Spec.InitProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayMulticastDomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDSelector, - To: reference.To{ - List: &TransitGatewayMulticastDomainList{}, - Managed: &TransitGatewayMulticastDomain{}, - }, - }) + "v1beta1", + + "TransitGatewayMulticastDomain", + + "TransitGatewayMulticastDomainList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayMulticastDomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayMulticastDomainID") } @@ -3865,69 +5893,112 @@ func (mg *TransitGatewayMulticastGroupMember) ResolveReferences(ctx context.Cont // ResolveReferences of this TransitGatewayMulticastGroupSource. func (mg *TransitGatewayMulticastGroupSource) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NetworkInterfaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.ForProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkInterfaceID") } mg.Spec.ForProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayMulticastDomain", + + "TransitGatewayMulticastDomainList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayMulticastDomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDSelector, - To: reference.To{ - List: &TransitGatewayMulticastDomainList{}, - Managed: &TransitGatewayMulticastDomain{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayMulticastDomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayMulticastDomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayMulticastDomainID") } mg.Spec.ForProvider.TransitGatewayMulticastDomainID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayMulticastDomainIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "NetworkInterface", + + "NetworkInterfaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, - Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, - To: reference.To{ - List: &NetworkInterfaceList{}, - Managed: &NetworkInterface{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NetworkInterfaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.NetworkInterfaceIDRef, + Selector: mg.Spec.InitProvider.NetworkInterfaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkInterfaceID") } mg.Spec.InitProvider.NetworkInterfaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.NetworkInterfaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayMulticastDomain", + + "TransitGatewayMulticastDomainList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayMulticastDomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDSelector, - To: reference.To{ - List: &TransitGatewayMulticastDomainList{}, - Managed: &TransitGatewayMulticastDomain{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayMulticastDomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayMulticastDomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayMulticastDomainID") } @@ -3939,69 +6010,112 @@ func (mg *TransitGatewayMulticastGroupSource) ResolveReferences(ctx context.Cont // ResolveReferences of this TransitGatewayPeeringAttachment. func (mg *TransitGatewayPeeringAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PeerTransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PeerTransitGatewayIDRef, - Selector: mg.Spec.ForProvider.PeerTransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PeerTransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PeerTransitGatewayIDRef, + Selector: mg.Spec.ForProvider.PeerTransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PeerTransitGatewayID") } mg.Spec.ForProvider.PeerTransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PeerTransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayID") } mg.Spec.ForProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PeerTransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PeerTransitGatewayIDRef, - Selector: mg.Spec.InitProvider.PeerTransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PeerTransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PeerTransitGatewayIDRef, + Selector: mg.Spec.InitProvider.PeerTransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PeerTransitGatewayID") } mg.Spec.InitProvider.PeerTransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PeerTransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayID") } @@ -4013,37 +6127,58 @@ func (mg *TransitGatewayPeeringAttachment) ResolveReferences(ctx context.Context // ResolveReferences of this TransitGatewayPeeringAttachmentAccepter. func (mg *TransitGatewayPeeringAttachmentAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayPeeringAttachment", + + "TransitGatewayPeeringAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayPeeringAttachmentList{}, - Managed: &TransitGatewayPeeringAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayAttachmentID") } mg.Spec.ForProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayPeeringAttachment", + + "TransitGatewayPeeringAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayPeeringAttachmentList{}, - Managed: &TransitGatewayPeeringAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayAttachmentID") } @@ -4055,37 +6190,60 @@ func (mg *TransitGatewayPeeringAttachmentAccepter) ResolveReferences(ctx context // ResolveReferences of this TransitGatewayPolicyTable. func (mg *TransitGatewayPolicyTable) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayID") } mg.Spec.ForProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayID") } @@ -4097,101 +6255,162 @@ func (mg *TransitGatewayPolicyTable) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this TransitGatewayPrefixListReference. func (mg *TransitGatewayPrefixListReference) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrefixListID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PrefixListIDRef, - Selector: mg.Spec.ForProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrefixListID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PrefixListIDRef, + Selector: mg.Spec.ForProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrefixListID") } mg.Spec.ForProvider.PrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayAttachmentID") } mg.Spec.ForProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayRouteTableID), - Extract: resource.ExtractParamPath("association_default_route_table_id", true), - Reference: mg.Spec.ForProvider.TransitGatewayRouteTableIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayRouteTableIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayRouteTableID), + Extract: resource.ExtractParamPath("association_default_route_table_id", true), + Reference: mg.Spec.ForProvider.TransitGatewayRouteTableIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayRouteTableID") } mg.Spec.ForProvider.TransitGatewayRouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayRouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrefixListID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PrefixListIDRef, - Selector: mg.Spec.InitProvider.PrefixListIDSelector, - To: reference.To{ - List: &ManagedPrefixListList{}, - Managed: &ManagedPrefixList{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrefixListID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PrefixListIDRef, + Selector: mg.Spec.InitProvider.PrefixListIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PrefixListID") } mg.Spec.InitProvider.PrefixListID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PrefixListIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayAttachmentID") } mg.Spec.InitProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayRouteTableID), - Extract: resource.ExtractParamPath("association_default_route_table_id", true), - Reference: mg.Spec.InitProvider.TransitGatewayRouteTableIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayRouteTableIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayRouteTableID), + Extract: resource.ExtractParamPath("association_default_route_table_id", true), + Reference: mg.Spec.InitProvider.TransitGatewayRouteTableIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayRouteTableID") } @@ -4203,69 +6422,110 @@ func (mg *TransitGatewayPrefixListReference) ResolveReferences(ctx context.Conte // ResolveReferences of this TransitGatewayRoute. func (mg *TransitGatewayRoute) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayAttachmentID") } mg.Spec.ForProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayRouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayRouteTableIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayRouteTableIDSelector, - To: reference.To{ - List: &TransitGatewayRouteTableList{}, - Managed: &TransitGatewayRouteTable{}, - }, - }) + "v1beta1", + + "TransitGatewayRouteTable", + + "TransitGatewayRouteTableList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayRouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayRouteTableIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayRouteTableID") } mg.Spec.ForProvider.TransitGatewayRouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayRouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayAttachmentID") } mg.Spec.InitProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayRouteTable", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayRouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayRouteTableIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayRouteTableIDSelector, - To: reference.To{ - List: &TransitGatewayRouteTableList{}, - Managed: &TransitGatewayRouteTable{}, - }, - }) + "TransitGatewayRouteTableList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayRouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayRouteTableIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayRouteTableID") } @@ -4277,37 +6537,60 @@ func (mg *TransitGatewayRoute) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this TransitGatewayRouteTable. func (mg *TransitGatewayRouteTable) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayID") } mg.Spec.ForProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayID") } @@ -4319,69 +6602,110 @@ func (mg *TransitGatewayRouteTable) ResolveReferences(ctx context.Context, c cli // ResolveReferences of this TransitGatewayRouteTableAssociation. func (mg *TransitGatewayRouteTableAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayAttachmentID") } mg.Spec.ForProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayRouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayRouteTableIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayRouteTableIDSelector, - To: reference.To{ - List: &TransitGatewayRouteTableList{}, - Managed: &TransitGatewayRouteTable{}, - }, - }) + "v1beta1", + + "TransitGatewayRouteTable", + + "TransitGatewayRouteTableList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayRouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayRouteTableIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayRouteTableID") } mg.Spec.ForProvider.TransitGatewayRouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayRouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayAttachmentID") } mg.Spec.InitProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayRouteTable", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayRouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayRouteTableIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayRouteTableIDSelector, - To: reference.To{ - List: &TransitGatewayRouteTableList{}, - Managed: &TransitGatewayRouteTable{}, - }, - }) + "TransitGatewayRouteTableList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayRouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayRouteTableIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayRouteTableID") } @@ -4393,69 +6717,110 @@ func (mg *TransitGatewayRouteTableAssociation) ResolveReferences(ctx context.Con // ResolveReferences of this TransitGatewayRouteTablePropagation. func (mg *TransitGatewayRouteTablePropagation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayAttachmentID") } mg.Spec.ForProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayRouteTable", + + "TransitGatewayRouteTableList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayRouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayRouteTableIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayRouteTableIDSelector, - To: reference.To{ - List: &TransitGatewayRouteTableList{}, - Managed: &TransitGatewayRouteTable{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayRouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayRouteTableIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayRouteTableID") } mg.Spec.ForProvider.TransitGatewayRouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayRouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayAttachmentID") } mg.Spec.InitProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayRouteTableID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayRouteTableIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayRouteTableIDSelector, - To: reference.To{ - List: &TransitGatewayRouteTableList{}, - Managed: &TransitGatewayRouteTable{}, - }, - }) + "TransitGatewayRouteTable", + + "TransitGatewayRouteTableList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayRouteTableID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayRouteTableIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayRouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayRouteTableID") } @@ -4467,102 +6832,159 @@ func (mg *TransitGatewayRouteTablePropagation) ResolveReferences(ctx context.Con // ResolveReferences of this TransitGatewayVPCAttachment. func (mg *TransitGatewayVPCAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayID") } mg.Spec.ForProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } mg.Spec.InitProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayID") } mg.Spec.InitProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -4574,37 +6996,60 @@ func (mg *TransitGatewayVPCAttachment) ResolveReferences(ctx context.Context, c // ResolveReferences of this TransitGatewayVPCAttachmentAccepter. func (mg *TransitGatewayVPCAttachmentAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayAttachmentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayAttachmentID") } mg.Spec.ForProvider.TransitGatewayAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayAttachmentIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGatewayVPCAttachment", + + "TransitGatewayVPCAttachmentList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, - To: reference.To{ - List: &TransitGatewayVPCAttachmentList{}, - Managed: &TransitGatewayVPCAttachment{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayAttachmentID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TransitGatewayAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayAttachmentID") } @@ -4616,37 +7061,58 @@ func (mg *TransitGatewayVPCAttachmentAccepter) ResolveReferences(ctx context.Con // ResolveReferences of this VPC. func (mg *VPC) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IPv4IpamPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IPv4IpamPoolIDRef, - Selector: mg.Spec.ForProvider.IPv4IpamPoolIDSelector, - To: reference.To{ - List: &VPCIpamPoolList{}, - Managed: &VPCIpamPool{}, - }, - }) + "VPCIpamPool", + "VPCIpamPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IPv4IpamPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IPv4IpamPoolIDRef, + Selector: mg.Spec.ForProvider.IPv4IpamPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IPv4IpamPoolID") } mg.Spec.ForProvider.IPv4IpamPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IPv4IpamPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IPv4IpamPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IPv4IpamPoolIDRef, - Selector: mg.Spec.InitProvider.IPv4IpamPoolIDSelector, - To: reference.To{ - List: &VPCIpamPoolList{}, - Managed: &VPCIpamPool{}, - }, - }) + "VPCIpamPool", + "VPCIpamPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IPv4IpamPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IPv4IpamPoolIDRef, + Selector: mg.Spec.InitProvider.IPv4IpamPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IPv4IpamPoolID") } @@ -4658,69 +7124,108 @@ func (mg *VPC) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this VPCDHCPOptionsAssociation. func (mg *VPCDHCPOptionsAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DHCPOptionsID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DHCPOptionsIDRef, - Selector: mg.Spec.ForProvider.DHCPOptionsIDSelector, - To: reference.To{ - List: &VPCDHCPOptionsList{}, - Managed: &VPCDHCPOptions{}, - }, - }) + "v1beta1", + + "VPCDHCPOptions", + + "VPCDHCPOptionsList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DHCPOptionsID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DHCPOptionsIDRef, + Selector: mg.Spec.ForProvider.DHCPOptionsIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DHCPOptionsID") } mg.Spec.ForProvider.DHCPOptionsID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DHCPOptionsIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCDHCPOptions", + + "VPCDHCPOptionsList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DHCPOptionsID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DHCPOptionsIDRef, - Selector: mg.Spec.InitProvider.DHCPOptionsIDSelector, - To: reference.To{ - List: &VPCDHCPOptionsList{}, - Managed: &VPCDHCPOptions{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DHCPOptionsID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DHCPOptionsIDRef, + Selector: mg.Spec.InitProvider.DHCPOptionsIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DHCPOptionsID") } mg.Spec.InitProvider.DHCPOptionsID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DHCPOptionsIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -4732,69 +7237,106 @@ func (mg *VPCDHCPOptionsAssociation) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this VPCEndpoint. func (mg *VPCEndpoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpointService", + + "VPCEndpointServiceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceName), - Extract: resource.ExtractParamPath("service_name", true), - Reference: mg.Spec.ForProvider.ServiceNameRef, - Selector: mg.Spec.ForProvider.ServiceNameSelector, - To: reference.To{ - List: &VPCEndpointServiceList{}, - Managed: &VPCEndpointService{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceName), + Extract: resource.ExtractParamPath("service_name", true), + Reference: mg.Spec.ForProvider.ServiceNameRef, + Selector: mg.Spec.ForProvider.ServiceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceName") } mg.Spec.ForProvider.ServiceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServiceNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpointService", + + "VPCEndpointServiceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceName), - Extract: resource.ExtractParamPath("service_name", true), - Reference: mg.Spec.InitProvider.ServiceNameRef, - Selector: mg.Spec.InitProvider.ServiceNameSelector, - To: reference.To{ - List: &VPCEndpointServiceList{}, - Managed: &VPCEndpointService{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceName), + Extract: resource.ExtractParamPath("service_name", true), + Reference: mg.Spec.InitProvider.ServiceNameRef, + Selector: mg.Spec.InitProvider.ServiceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceName") } mg.Spec.InitProvider.ServiceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ServiceNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -4806,69 +7348,108 @@ func (mg *VPCEndpoint) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this VPCEndpointConnectionNotification. func (mg *VPCEndpointConnectionNotification) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionNotificationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ConnectionNotificationArnRef, - Selector: mg.Spec.ForProvider.ConnectionNotificationArnSelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectionNotificationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ConnectionNotificationArnRef, + Selector: mg.Spec.ForProvider.ConnectionNotificationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectionNotificationArn") } - mg.Spec.ForProvider.ConnectionNotificationArn = reference.ToPtrValue(rsp.ResolvedValue) - mg.Spec.ForProvider.ConnectionNotificationArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointServiceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCEndpointServiceIDRef, - Selector: mg.Spec.ForProvider.VPCEndpointServiceIDSelector, - To: reference.To{ - List: &VPCEndpointServiceList{}, - Managed: &VPCEndpointService{}, - }, - }) + mg.Spec.ForProvider.ConnectionNotificationArn = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.ConnectionNotificationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpointService", + + "VPCEndpointServiceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointServiceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCEndpointServiceIDRef, + Selector: mg.Spec.ForProvider.VPCEndpointServiceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCEndpointServiceID") } mg.Spec.ForProvider.VPCEndpointServiceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCEndpointServiceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionNotificationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ConnectionNotificationArnRef, - Selector: mg.Spec.InitProvider.ConnectionNotificationArnSelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectionNotificationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ConnectionNotificationArnRef, + Selector: mg.Spec.InitProvider.ConnectionNotificationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectionNotificationArn") } mg.Spec.InitProvider.ConnectionNotificationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConnectionNotificationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpointService", + + "VPCEndpointServiceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointServiceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCEndpointServiceIDRef, - Selector: mg.Spec.InitProvider.VPCEndpointServiceIDSelector, - To: reference.To{ - List: &VPCEndpointServiceList{}, - Managed: &VPCEndpointService{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointServiceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCEndpointServiceIDRef, + Selector: mg.Spec.InitProvider.VPCEndpointServiceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCEndpointServiceID") } @@ -4880,69 +7461,108 @@ func (mg *VPCEndpointConnectionNotification) ResolveReferences(ctx context.Conte // ResolveReferences of this VPCEndpointRouteTableAssociation. func (mg *VPCEndpointRouteTableAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RouteTableIDRef, - Selector: mg.Spec.ForProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RouteTableIDRef, + Selector: mg.Spec.ForProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RouteTableID") } mg.Spec.ForProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpoint", + "VPCEndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCEndpointIDRef, - Selector: mg.Spec.ForProvider.VPCEndpointIDSelector, - To: reference.To{ - List: &VPCEndpointList{}, - Managed: &VPCEndpoint{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCEndpointIDRef, + Selector: mg.Spec.ForProvider.VPCEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCEndpointID") } mg.Spec.ForProvider.VPCEndpointID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCEndpointIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RouteTableIDRef, - Selector: mg.Spec.InitProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RouteTableIDRef, + Selector: mg.Spec.InitProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RouteTableID") } mg.Spec.InitProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpoint", + "VPCEndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCEndpointIDRef, - Selector: mg.Spec.InitProvider.VPCEndpointIDSelector, - To: reference.To{ - List: &VPCEndpointList{}, - Managed: &VPCEndpoint{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCEndpointIDRef, + Selector: mg.Spec.InitProvider.VPCEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCEndpointID") } @@ -4954,69 +7574,108 @@ func (mg *VPCEndpointRouteTableAssociation) ResolveReferences(ctx context.Contex // ResolveReferences of this VPCEndpointSecurityGroupAssociation. func (mg *VPCEndpointSecurityGroupAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SecurityGroupIDRef, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SecurityGroupIDRef, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupID") } mg.Spec.ForProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpoint", + "VPCEndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCEndpointIDRef, - Selector: mg.Spec.ForProvider.VPCEndpointIDSelector, - To: reference.To{ - List: &VPCEndpointList{}, - Managed: &VPCEndpoint{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCEndpointIDRef, + Selector: mg.Spec.ForProvider.VPCEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCEndpointID") } mg.Spec.ForProvider.VPCEndpointID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCEndpointIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SecurityGroupIDRef, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &SecurityGroupList{}, - Managed: &SecurityGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SecurityGroupIDRef, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupID") } mg.Spec.InitProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SecurityGroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpoint", + "VPCEndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCEndpointIDRef, - Selector: mg.Spec.InitProvider.VPCEndpointIDSelector, - To: reference.To{ - List: &VPCEndpointList{}, - Managed: &VPCEndpoint{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCEndpointIDRef, + Selector: mg.Spec.InitProvider.VPCEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCEndpointID") } @@ -5028,37 +7687,58 @@ func (mg *VPCEndpointSecurityGroupAssociation) ResolveReferences(ctx context.Con // ResolveReferences of this VPCEndpointServiceAllowedPrincipal. func (mg *VPCEndpointServiceAllowedPrincipal) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointServiceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCEndpointServiceIDRef, - Selector: mg.Spec.ForProvider.VPCEndpointServiceIDSelector, - To: reference.To{ - List: &VPCEndpointServiceList{}, - Managed: &VPCEndpointService{}, - }, - }) + "VPCEndpointService", + + "VPCEndpointServiceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointServiceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCEndpointServiceIDRef, + Selector: mg.Spec.ForProvider.VPCEndpointServiceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCEndpointServiceID") } mg.Spec.ForProvider.VPCEndpointServiceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCEndpointServiceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointServiceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCEndpointServiceIDRef, - Selector: mg.Spec.InitProvider.VPCEndpointServiceIDSelector, - To: reference.To{ - List: &VPCEndpointServiceList{}, - Managed: &VPCEndpointService{}, - }, - }) + "v1beta1", + + "VPCEndpointService", + + "VPCEndpointServiceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointServiceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCEndpointServiceIDRef, + Selector: mg.Spec.InitProvider.VPCEndpointServiceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCEndpointServiceID") } @@ -5070,69 +7750,108 @@ func (mg *VPCEndpointServiceAllowedPrincipal) ResolveReferences(ctx context.Cont // ResolveReferences of this VPCEndpointSubnetAssociation. func (mg *VPCEndpointSubnetAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpoint", + "VPCEndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCEndpointIDRef, - Selector: mg.Spec.ForProvider.VPCEndpointIDSelector, - To: reference.To{ - List: &VPCEndpointList{}, - Managed: &VPCEndpoint{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCEndpointID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCEndpointIDRef, + Selector: mg.Spec.ForProvider.VPCEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCEndpointID") } mg.Spec.ForProvider.VPCEndpointID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCEndpointIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &SubnetList{}, - Managed: &Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } mg.Spec.InitProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCEndpoint", + "VPCEndpointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCEndpointIDRef, - Selector: mg.Spec.InitProvider.VPCEndpointIDSelector, - To: reference.To{ - List: &VPCEndpointList{}, - Managed: &VPCEndpoint{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCEndpointID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCEndpointIDRef, + Selector: mg.Spec.InitProvider.VPCEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCEndpointID") } @@ -5144,37 +7863,56 @@ func (mg *VPCEndpointSubnetAssociation) ResolveReferences(ctx context.Context, c // ResolveReferences of this VPCIPv4CidrBlockAssociation. func (mg *VPCIPv4CidrBlockAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -5186,69 +7924,108 @@ func (mg *VPCIPv4CidrBlockAssociation) ResolveReferences(ctx context.Context, c // ResolveReferences of this VPCIpamPool. func (mg *VPCIpamPool) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIpamScope", + "VPCIpamScopeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IpamScopeID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.IpamScopeIDRef, - Selector: mg.Spec.ForProvider.IpamScopeIDSelector, - To: reference.To{ - List: &VPCIpamScopeList{}, - Managed: &VPCIpamScope{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IpamScopeID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.IpamScopeIDRef, + Selector: mg.Spec.ForProvider.IpamScopeIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IpamScopeID") } mg.Spec.ForProvider.IpamScopeID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IpamScopeIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIpamPool", + "VPCIpamPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceIpamPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SourceIpamPoolIDRef, - Selector: mg.Spec.ForProvider.SourceIpamPoolIDSelector, - To: reference.To{ - List: &VPCIpamPoolList{}, - Managed: &VPCIpamPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceIpamPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SourceIpamPoolIDRef, + Selector: mg.Spec.ForProvider.SourceIpamPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceIpamPoolID") } mg.Spec.ForProvider.SourceIpamPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceIpamPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIpamScope", + "VPCIpamScopeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IpamScopeID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.IpamScopeIDRef, - Selector: mg.Spec.InitProvider.IpamScopeIDSelector, - To: reference.To{ - List: &VPCIpamScopeList{}, - Managed: &VPCIpamScope{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IpamScopeID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.IpamScopeIDRef, + Selector: mg.Spec.InitProvider.IpamScopeIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IpamScopeID") } mg.Spec.InitProvider.IpamScopeID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IpamScopeIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIpamPool", + "VPCIpamPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceIpamPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SourceIpamPoolIDRef, - Selector: mg.Spec.InitProvider.SourceIpamPoolIDSelector, - To: reference.To{ - List: &VPCIpamPoolList{}, - Managed: &VPCIpamPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceIpamPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SourceIpamPoolIDRef, + Selector: mg.Spec.InitProvider.SourceIpamPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceIpamPoolID") } @@ -5260,37 +8037,58 @@ func (mg *VPCIpamPool) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this VPCIpamPoolCidr. func (mg *VPCIpamPoolCidr) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIpamPool", + "VPCIpamPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IpamPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IpamPoolIDRef, - Selector: mg.Spec.ForProvider.IpamPoolIDSelector, - To: reference.To{ - List: &VPCIpamPoolList{}, - Managed: &VPCIpamPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IpamPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IpamPoolIDRef, + Selector: mg.Spec.ForProvider.IpamPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IpamPoolID") } mg.Spec.ForProvider.IpamPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IpamPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIpamPool", + "VPCIpamPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IpamPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IpamPoolIDRef, - Selector: mg.Spec.InitProvider.IpamPoolIDSelector, - To: reference.To{ - List: &VPCIpamPoolList{}, - Managed: &VPCIpamPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IpamPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IpamPoolIDRef, + Selector: mg.Spec.InitProvider.IpamPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IpamPoolID") } @@ -5302,37 +8100,58 @@ func (mg *VPCIpamPoolCidr) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this VPCIpamPoolCidrAllocation. func (mg *VPCIpamPoolCidrAllocation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIpamPool", + "VPCIpamPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IpamPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IpamPoolIDRef, - Selector: mg.Spec.ForProvider.IpamPoolIDSelector, - To: reference.To{ - List: &VPCIpamPoolList{}, - Managed: &VPCIpamPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IpamPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IpamPoolIDRef, + Selector: mg.Spec.ForProvider.IpamPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IpamPoolID") } mg.Spec.ForProvider.IpamPoolID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IpamPoolIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCIpamPool", + "VPCIpamPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IpamPoolID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IpamPoolIDRef, - Selector: mg.Spec.InitProvider.IpamPoolIDSelector, - To: reference.To{ - List: &VPCIpamPoolList{}, - Managed: &VPCIpamPool{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IpamPoolID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IpamPoolIDRef, + Selector: mg.Spec.InitProvider.IpamPoolIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IpamPoolID") } @@ -5344,37 +8163,58 @@ func (mg *VPCIpamPoolCidrAllocation) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this VPCIpamScope. func (mg *VPCIpamScope) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IpamID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.IpamIDRef, - Selector: mg.Spec.ForProvider.IpamIDSelector, - To: reference.To{ - List: &VPCIpamList{}, - Managed: &VPCIpam{}, - }, - }) + "VPCIpam", + "VPCIpamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IpamID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.IpamIDRef, + Selector: mg.Spec.ForProvider.IpamIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IpamID") } mg.Spec.ForProvider.IpamID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IpamIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IpamID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.IpamIDRef, - Selector: mg.Spec.InitProvider.IpamIDSelector, - To: reference.To{ - List: &VPCIpamList{}, - Managed: &VPCIpam{}, - }, - }) + "VPCIpam", + "VPCIpamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IpamID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.IpamIDRef, + Selector: mg.Spec.InitProvider.IpamIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IpamID") } @@ -5386,69 +8226,104 @@ func (mg *VPCIpamScope) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this VPCPeeringConnection. func (mg *VPCPeeringConnection) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PeerVPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PeerVPCIDRef, - Selector: mg.Spec.ForProvider.PeerVPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PeerVPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PeerVPCIDRef, + Selector: mg.Spec.ForProvider.PeerVPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PeerVPCID") } mg.Spec.ForProvider.PeerVPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PeerVPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PeerVPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PeerVPCIDRef, - Selector: mg.Spec.InitProvider.PeerVPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PeerVPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PeerVPCIDRef, + Selector: mg.Spec.InitProvider.PeerVPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PeerVPCID") } mg.Spec.InitProvider.PeerVPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PeerVPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -5460,37 +8335,58 @@ func (mg *VPCPeeringConnection) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this VPCPeeringConnectionAccepter. func (mg *VPCPeeringConnectionAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCPeeringConnection", + + "VPCPeeringConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCPeeringConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCPeeringConnectionIDRef, - Selector: mg.Spec.ForProvider.VPCPeeringConnectionIDSelector, - To: reference.To{ - List: &VPCPeeringConnectionList{}, - Managed: &VPCPeeringConnection{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCPeeringConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCPeeringConnectionIDRef, + Selector: mg.Spec.ForProvider.VPCPeeringConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCPeeringConnectionID") } mg.Spec.ForProvider.VPCPeeringConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCPeeringConnectionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCPeeringConnection", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCPeeringConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCPeeringConnectionIDRef, - Selector: mg.Spec.InitProvider.VPCPeeringConnectionIDSelector, - To: reference.To{ - List: &VPCPeeringConnectionList{}, - Managed: &VPCPeeringConnection{}, - }, - }) + "VPCPeeringConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCPeeringConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCPeeringConnectionIDRef, + Selector: mg.Spec.InitProvider.VPCPeeringConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCPeeringConnectionID") } @@ -5502,37 +8398,58 @@ func (mg *VPCPeeringConnectionAccepter) ResolveReferences(ctx context.Context, c // ResolveReferences of this VPCPeeringConnectionOptions. func (mg *VPCPeeringConnectionOptions) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCPeeringConnection", + + "VPCPeeringConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCPeeringConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCPeeringConnectionIDRef, - Selector: mg.Spec.ForProvider.VPCPeeringConnectionIDSelector, - To: reference.To{ - List: &VPCPeeringConnectionList{}, - Managed: &VPCPeeringConnection{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCPeeringConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCPeeringConnectionIDRef, + Selector: mg.Spec.ForProvider.VPCPeeringConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCPeeringConnectionID") } mg.Spec.ForProvider.VPCPeeringConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCPeeringConnectionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPCPeeringConnection", + + "VPCPeeringConnectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCPeeringConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCPeeringConnectionIDRef, - Selector: mg.Spec.InitProvider.VPCPeeringConnectionIDSelector, - To: reference.To{ - List: &VPCPeeringConnectionList{}, - Managed: &VPCPeeringConnection{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCPeeringConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCPeeringConnectionIDRef, + Selector: mg.Spec.InitProvider.VPCPeeringConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCPeeringConnectionID") } @@ -5544,133 +8461,214 @@ func (mg *VPCPeeringConnectionOptions) ResolveReferences(ctx context.Context, c // ResolveReferences of this VPNConnection. func (mg *VPNConnection) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomerGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.CustomerGatewayIDRef, - Selector: mg.Spec.ForProvider.CustomerGatewayIDSelector, - To: reference.To{ - List: &CustomerGatewayList{}, - Managed: &CustomerGateway{}, - }, - }) + "CustomerGateway", + + "CustomerGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomerGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.CustomerGatewayIDRef, + Selector: mg.Spec.ForProvider.CustomerGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomerGatewayID") } mg.Spec.ForProvider.CustomerGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CustomerGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransitGatewayIDRef, - Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransitGatewayIDRef, + Selector: mg.Spec.ForProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayID") } mg.Spec.ForProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "CustomerGateway", + + "CustomerGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Type), - Extract: resource.ExtractParamPath("type", false), - Reference: mg.Spec.ForProvider.TypeRef, - Selector: mg.Spec.ForProvider.TypeSelector, - To: reference.To{ - List: &CustomerGatewayList{}, - Managed: &CustomerGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Type), + Extract: resource.ExtractParamPath("type", false), + Reference: mg.Spec.ForProvider.TypeRef, + Selector: mg.Spec.ForProvider.TypeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Type") } mg.Spec.ForProvider.Type = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TypeRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPNGatewayIDRef, - Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &VPNGatewayList{}, - Managed: &VPNGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPNGatewayIDRef, + Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPNGatewayID") } mg.Spec.ForProvider.VPNGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPNGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "CustomerGateway", + + "CustomerGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CustomerGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.CustomerGatewayIDRef, - Selector: mg.Spec.InitProvider.CustomerGatewayIDSelector, - To: reference.To{ - List: &CustomerGatewayList{}, - Managed: &CustomerGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CustomerGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.CustomerGatewayIDRef, + Selector: mg.Spec.InitProvider.CustomerGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomerGatewayID") } mg.Spec.InitProvider.CustomerGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CustomerGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransitGatewayIDRef, - Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, - To: reference.To{ - List: &TransitGatewayList{}, - Managed: &TransitGateway{}, - }, - }) + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransitGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransitGatewayIDRef, + Selector: mg.Spec.InitProvider.TransitGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransitGatewayID") } mg.Spec.InitProvider.TransitGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TransitGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "CustomerGateway", + + "CustomerGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Type), - Extract: resource.ExtractParamPath("type", false), - Reference: mg.Spec.InitProvider.TypeRef, - Selector: mg.Spec.InitProvider.TypeSelector, - To: reference.To{ - List: &CustomerGatewayList{}, - Managed: &CustomerGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Type), + Extract: resource.ExtractParamPath("type", false), + Reference: mg.Spec.InitProvider.TypeRef, + Selector: mg.Spec.InitProvider.TypeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Type") } mg.Spec.InitProvider.Type = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.TypeRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPNGatewayIDRef, - Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &VPNGatewayList{}, - Managed: &VPNGateway{}, - }, - }) + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPNGatewayIDRef, + Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPNGatewayID") } @@ -5682,37 +8680,58 @@ func (mg *VPNConnection) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this VPNConnectionRoute. func (mg *VPNConnectionRoute) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNConnection", + "VPNConnectionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPNConnectionIDRef, - Selector: mg.Spec.ForProvider.VPNConnectionIDSelector, - To: reference.To{ - List: &VPNConnectionList{}, - Managed: &VPNConnection{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPNConnectionIDRef, + Selector: mg.Spec.ForProvider.VPNConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPNConnectionID") } mg.Spec.ForProvider.VPNConnectionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPNConnectionIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNConnection", + "VPNConnectionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNConnectionID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPNConnectionIDRef, - Selector: mg.Spec.InitProvider.VPNConnectionIDSelector, - To: reference.To{ - List: &VPNConnectionList{}, - Managed: &VPNConnection{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNConnectionID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPNConnectionIDRef, + Selector: mg.Spec.InitProvider.VPNConnectionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPNConnectionID") } @@ -5724,37 +8743,56 @@ func (mg *VPNConnectionRoute) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this VPNGateway. func (mg *VPNGateway) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -5766,69 +8804,106 @@ func (mg *VPNGateway) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this VPNGatewayAttachment. func (mg *VPNGatewayAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPNGatewayIDRef, - Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &VPNGatewayList{}, - Managed: &VPNGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPNGatewayIDRef, + Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPNGatewayID") } mg.Spec.ForProvider.VPNGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPNGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &VPCList{}, - Managed: &VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } mg.Spec.InitProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPNGatewayIDRef, - Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &VPNGatewayList{}, - Managed: &VPNGateway{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPNGatewayIDRef, + Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPNGatewayID") } @@ -5840,69 +8915,108 @@ func (mg *VPNGatewayAttachment) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this VPNGatewayRoutePropagation. func (mg *VPNGatewayRoutePropagation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RouteTableIDRef, - Selector: mg.Spec.ForProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RouteTableID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RouteTableIDRef, + Selector: mg.Spec.ForProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RouteTableID") } mg.Spec.ForProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPNGatewayIDRef, - Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &VPNGatewayList{}, - Managed: &VPNGateway{}, - }, - }) + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPNGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPNGatewayIDRef, + Selector: mg.Spec.ForProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPNGatewayID") } mg.Spec.ForProvider.VPNGatewayID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPNGatewayIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RouteTableIDRef, - Selector: mg.Spec.InitProvider.RouteTableIDSelector, - To: reference.To{ - List: &RouteTableList{}, - Managed: &RouteTable{}, - }, - }) + "RouteTable", + "RouteTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RouteTableID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RouteTableIDRef, + Selector: mg.Spec.InitProvider.RouteTableIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RouteTableID") } mg.Spec.InitProvider.RouteTableID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RouteTableIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPNGatewayIDRef, - Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, - To: reference.To{ - List: &VPNGatewayList{}, - Managed: &VPNGateway{}, - }, - }) + "VPNGateway", + "VPNGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPNGatewayID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPNGatewayIDRef, + Selector: mg.Spec.InitProvider.VPNGatewayIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPNGatewayID") } @@ -5914,69 +9028,108 @@ func (mg *VPNGatewayRoutePropagation) ResolveReferences(ctx context.Context, c c // ResolveReferences of this VolumeAttachment. func (mg *VolumeAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceIDRef, - Selector: mg.Spec.ForProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") } mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VolumeID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VolumeIDRef, - Selector: mg.Spec.ForProvider.VolumeIDSelector, - To: reference.To{ - List: &EBSVolumeList{}, - Managed: &EBSVolume{}, - }, - }) + "v1beta1", + + "EBSVolume", + "EBSVolumeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VolumeID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VolumeIDRef, + Selector: mg.Spec.ForProvider.VolumeIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VolumeID") } mg.Spec.ForProvider.VolumeID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VolumeIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceIDRef, - Selector: mg.Spec.InitProvider.InstanceIDSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") } mg.Spec.InitProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.InstanceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VolumeID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VolumeIDRef, - Selector: mg.Spec.InitProvider.VolumeIDSelector, - To: reference.To{ - List: &EBSVolumeList{}, - Managed: &EBSVolume{}, - }, - }) + "v1beta1", + + "EBSVolume", + "EBSVolumeList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VolumeID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VolumeIDRef, + Selector: mg.Spec.InitProvider.VolumeIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VolumeID") } diff --git a/apis/ecr/v1beta1/zz_generated.resolvers.go b/apis/ecr/v1beta1/zz_generated.resolvers.go index 7645ed4c78..aff64db9d3 100644 --- a/apis/ecr/v1beta1/zz_generated.resolvers.go +++ b/apis/ecr/v1beta1/zz_generated.resolvers.go @@ -9,44 +9,68 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this LifecyclePolicy. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this LifecyclePolicy. func (mg *LifecyclePolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ecr.aws.upbound.io", + + "v1beta1", + + "Repository", + "RepositoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Repository), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RepositoryRef, - Selector: mg.Spec.ForProvider.RepositorySelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Repository), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RepositoryRef, + Selector: mg.Spec.ForProvider.RepositorySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Repository") } mg.Spec.ForProvider.Repository = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RepositoryRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ecr.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Repository), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RepositoryRef, - Selector: mg.Spec.InitProvider.RepositorySelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + "v1beta1", + + "Repository", + "RepositoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Repository), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RepositoryRef, + Selector: mg.Spec.InitProvider.RepositorySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Repository") } @@ -58,22 +82,34 @@ func (mg *LifecyclePolicy) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this Repository. func (mg *Repository) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.EncryptionConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionConfiguration[i3].KMSKey), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.EncryptionConfiguration[i3].KMSKeyRef, - Selector: mg.Spec.ForProvider.EncryptionConfiguration[i3].KMSKeySelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionConfiguration[i3].KMSKey), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.EncryptionConfiguration[i3].KMSKeyRef, + Selector: mg.Spec.ForProvider.EncryptionConfiguration[i3].KMSKeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EncryptionConfiguration[i3].KMSKey") } @@ -82,16 +118,25 @@ func (mg *Repository) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.InitProvider.EncryptionConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionConfiguration[i3].KMSKey), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.EncryptionConfiguration[i3].KMSKeyRef, - Selector: mg.Spec.InitProvider.EncryptionConfiguration[i3].KMSKeySelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionConfiguration[i3].KMSKey), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.EncryptionConfiguration[i3].KMSKeyRef, + Selector: mg.Spec.InitProvider.EncryptionConfiguration[i3].KMSKeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EncryptionConfiguration[i3].KMSKey") } @@ -105,37 +150,58 @@ func (mg *Repository) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this RepositoryPolicy. func (mg *RepositoryPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ecr.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Repository), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RepositoryRef, - Selector: mg.Spec.ForProvider.RepositorySelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + "v1beta1", + + "Repository", + "RepositoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Repository), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RepositoryRef, + Selector: mg.Spec.ForProvider.RepositorySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Repository") } mg.Spec.ForProvider.Repository = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RepositoryRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ecr.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Repository), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RepositoryRef, - Selector: mg.Spec.InitProvider.RepositorySelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + "Repository", + "RepositoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Repository), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RepositoryRef, + Selector: mg.Spec.InitProvider.RepositorySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Repository") } diff --git a/apis/ecrpublic/v1beta1/zz_generated.resolvers.go b/apis/ecrpublic/v1beta1/zz_generated.resolvers.go index 343c5cb7d1..fa5c0f0f47 100644 --- a/apis/ecrpublic/v1beta1/zz_generated.resolvers.go +++ b/apis/ecrpublic/v1beta1/zz_generated.resolvers.go @@ -8,43 +8,69 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this RepositoryPolicy. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this RepositoryPolicy. func (mg *RepositoryPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ecrpublic.aws.upbound.io", + + "v1beta1", + + "Repository", + + "RepositoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RepositoryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RepositoryNameRef, - Selector: mg.Spec.ForProvider.RepositoryNameSelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RepositoryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RepositoryNameRef, + Selector: mg.Spec.ForProvider.RepositoryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RepositoryName") } mg.Spec.ForProvider.RepositoryName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RepositoryNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ecrpublic.aws.upbound.io", + + "v1beta1", + + "Repository", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RepositoryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RepositoryNameRef, - Selector: mg.Spec.InitProvider.RepositoryNameSelector, - To: reference.To{ - List: &RepositoryList{}, - Managed: &Repository{}, - }, - }) + "RepositoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RepositoryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RepositoryNameRef, + Selector: mg.Spec.InitProvider.RepositoryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RepositoryName") } diff --git a/apis/ecs/v1beta1/zz_generated.resolvers.go b/apis/ecs/v1beta1/zz_generated.resolvers.go index 8e43b44be8..332d49ed8c 100644 --- a/apis/ecs/v1beta1/zz_generated.resolvers.go +++ b/apis/ecs/v1beta1/zz_generated.resolvers.go @@ -9,32 +9,45 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this CapacityProvider. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this CapacityProvider. func (mg *CapacityProvider) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.AutoScalingGroupProvider); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArnRef, - Selector: mg.Spec.ForProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArnSelector, - To: reference.To{ - List: &v1beta1.AutoscalingGroupList{}, - Managed: &v1beta1.AutoscalingGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", + + "AutoscalingGroup", + + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArnRef, + Selector: mg.Spec.ForProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArn") } @@ -43,16 +56,26 @@ func (mg *CapacityProvider) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.InitProvider.AutoScalingGroupProvider); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArnRef, - Selector: mg.Spec.InitProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArnSelector, - To: reference.To{ - List: &v1beta1.AutoscalingGroupList{}, - Managed: &v1beta1.AutoscalingGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("autoscaling.aws.upbound.io", + + "v1beta1", + + "AutoscalingGroup", + + "AutoscalingGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArnRef, + Selector: mg.Spec.InitProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AutoScalingGroupProvider[i3].AutoScalingGroupArn") } @@ -66,37 +89,58 @@ func (mg *CapacityProvider) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this ClusterCapacityProviders. func (mg *ClusterCapacityProviders) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterNameRef, - Selector: mg.Spec.ForProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterNameRef, + Selector: mg.Spec.ForProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterName") } mg.Spec.ForProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterNameRef, - Selector: mg.Spec.InitProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterNameRef, + Selector: mg.Spec.InitProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterName") } @@ -108,38 +152,60 @@ func (mg *ClusterCapacityProviders) ResolveReferences(ctx context.Context, c cli // ResolveReferences of this Service. func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Cluster), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterRef, - Selector: mg.Spec.ForProvider.ClusterSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Cluster), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterRef, + Selector: mg.Spec.ForProvider.ClusterSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Cluster") } mg.Spec.ForProvider.Cluster = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRole), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMRoleRef, - Selector: mg.Spec.ForProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRole), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMRoleRef, + Selector: mg.Spec.ForProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRole") } @@ -147,16 +213,27 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.IAMRoleRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.LoadBalancer); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer[i3].TargetGroupArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoadBalancer[i3].TargetGroupArnRef, - Selector: mg.Spec.ForProvider.LoadBalancer[i3].TargetGroupArnSelector, - To: reference.To{ - List: &v1beta12.LBTargetGroupList{}, - Managed: &v1beta12.LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer[i3].TargetGroupArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoadBalancer[i3].TargetGroupArnRef, + Selector: mg.Spec.ForProvider.LoadBalancer[i3].TargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancer[i3].TargetGroupArn") } @@ -165,16 +242,26 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.NetworkConfiguration); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.NetworkConfiguration[i3].SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.NetworkConfiguration[i3].SecurityGroupRefs, - Selector: mg.Spec.ForProvider.NetworkConfiguration[i3].SecurityGroupSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.NetworkConfiguration[i3].SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.NetworkConfiguration[i3].SecurityGroupRefs, + Selector: mg.Spec.ForProvider.NetworkConfiguration[i3].SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkConfiguration[i3].SecurityGroups") } @@ -183,16 +270,26 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.NetworkConfiguration); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.NetworkConfiguration[i3].Subnets), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.NetworkConfiguration[i3].SubnetRefs, - Selector: mg.Spec.ForProvider.NetworkConfiguration[i3].SubnetSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.NetworkConfiguration[i3].Subnets), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.NetworkConfiguration[i3].SubnetRefs, + Selector: mg.Spec.ForProvider.NetworkConfiguration[i3].SubnetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NetworkConfiguration[i3].Subnets") } @@ -200,48 +297,78 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.NetworkConfiguration[i3].SubnetRefs = mrsp.ResolvedReferences } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskDefinition), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TaskDefinitionRef, - Selector: mg.Spec.ForProvider.TaskDefinitionSelector, - To: reference.To{ - List: &TaskDefinitionList{}, - Managed: &TaskDefinition{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "TaskDefinition", + + "TaskDefinitionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskDefinition), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TaskDefinitionRef, + Selector: mg.Spec.ForProvider.TaskDefinitionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TaskDefinition") } mg.Spec.ForProvider.TaskDefinition = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TaskDefinitionRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Cluster), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterRef, - Selector: mg.Spec.InitProvider.ClusterSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Cluster), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterRef, + Selector: mg.Spec.InitProvider.ClusterSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Cluster") } mg.Spec.InitProvider.Cluster = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRole), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMRoleRef, - Selector: mg.Spec.InitProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRole), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMRoleRef, + Selector: mg.Spec.InitProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRole") } @@ -249,16 +376,27 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.IAMRoleRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.LoadBalancer); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancer[i3].TargetGroupArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoadBalancer[i3].TargetGroupArnRef, - Selector: mg.Spec.InitProvider.LoadBalancer[i3].TargetGroupArnSelector, - To: reference.To{ - List: &v1beta12.LBTargetGroupList{}, - Managed: &v1beta12.LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancer[i3].TargetGroupArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoadBalancer[i3].TargetGroupArnRef, + Selector: mg.Spec.InitProvider.LoadBalancer[i3].TargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancer[i3].TargetGroupArn") } @@ -267,16 +405,26 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.NetworkConfiguration); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.NetworkConfiguration[i3].SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.NetworkConfiguration[i3].SecurityGroupRefs, - Selector: mg.Spec.InitProvider.NetworkConfiguration[i3].SecurityGroupSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.NetworkConfiguration[i3].SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.NetworkConfiguration[i3].SecurityGroupRefs, + Selector: mg.Spec.InitProvider.NetworkConfiguration[i3].SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkConfiguration[i3].SecurityGroups") } @@ -285,16 +433,26 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.NetworkConfiguration); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.NetworkConfiguration[i3].Subnets), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.NetworkConfiguration[i3].SubnetRefs, - Selector: mg.Spec.InitProvider.NetworkConfiguration[i3].SubnetSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.NetworkConfiguration[i3].Subnets), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.NetworkConfiguration[i3].SubnetRefs, + Selector: mg.Spec.InitProvider.NetworkConfiguration[i3].SubnetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NetworkConfiguration[i3].Subnets") } @@ -302,16 +460,27 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.NetworkConfiguration[i3].SubnetRefs = mrsp.ResolvedReferences } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskDefinition), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TaskDefinitionRef, - Selector: mg.Spec.InitProvider.TaskDefinitionSelector, - To: reference.To{ - List: &TaskDefinitionList{}, - Managed: &TaskDefinition{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "TaskDefinition", + + "TaskDefinitionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskDefinition), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TaskDefinitionRef, + Selector: mg.Spec.InitProvider.TaskDefinitionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TaskDefinition") } @@ -323,37 +492,60 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this TaskDefinition. func (mg *TaskDefinition) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ExecutionRoleArnRef, - Selector: mg.Spec.ForProvider.ExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ExecutionRoleArnRef, + Selector: mg.Spec.ForProvider.ExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExecutionRoleArn") } mg.Spec.ForProvider.ExecutionRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ExecutionRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ExecutionRoleArnRef, - Selector: mg.Spec.InitProvider.ExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ExecutionRoleArnRef, + Selector: mg.Spec.InitProvider.ExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExecutionRoleArn") } diff --git a/apis/efs/v1beta1/zz_generated.resolvers.go b/apis/efs/v1beta1/zz_generated.resolvers.go index 0218194f56..506f1fe099 100644 --- a/apis/efs/v1beta1/zz_generated.resolvers.go +++ b/apis/efs/v1beta1/zz_generated.resolvers.go @@ -10,45 +10,68 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AccessPoint. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this AccessPoint. func (mg *AccessPoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.FileSystemIDRef, - Selector: mg.Spec.ForProvider.FileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.FileSystemIDRef, + Selector: mg.Spec.ForProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FileSystemID") } mg.Spec.ForProvider.FileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FileSystemIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.FileSystemIDRef, - Selector: mg.Spec.InitProvider.FileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.FileSystemIDRef, + Selector: mg.Spec.InitProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FileSystemID") } @@ -60,37 +83,58 @@ func (mg *AccessPoint) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this BackupPolicy. func (mg *BackupPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.FileSystemIDRef, - Selector: mg.Spec.ForProvider.FileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.FileSystemIDRef, + Selector: mg.Spec.ForProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FileSystemID") } mg.Spec.ForProvider.FileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FileSystemIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.FileSystemIDRef, - Selector: mg.Spec.InitProvider.FileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.FileSystemIDRef, + Selector: mg.Spec.InitProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FileSystemID") } @@ -102,37 +146,56 @@ func (mg *BackupPolicy) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this FileSystem. func (mg *FileSystem) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -144,37 +207,58 @@ func (mg *FileSystem) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this FileSystemPolicy. func (mg *FileSystemPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.FileSystemIDRef, - Selector: mg.Spec.ForProvider.FileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.FileSystemIDRef, + Selector: mg.Spec.ForProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FileSystemID") } mg.Spec.ForProvider.FileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FileSystemIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.FileSystemIDRef, - Selector: mg.Spec.InitProvider.FileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.FileSystemIDRef, + Selector: mg.Spec.InitProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FileSystemID") } @@ -186,102 +270,159 @@ func (mg *FileSystemPolicy) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this MountTarget. func (mg *MountTarget) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.FileSystemIDRef, - Selector: mg.Spec.ForProvider.FileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.FileSystemIDRef, + Selector: mg.Spec.ForProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FileSystemID") } mg.Spec.ForProvider.FileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FileSystemIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupsRefs, - Selector: mg.Spec.ForProvider.SecurityGroupsSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupsRefs, + Selector: mg.Spec.ForProvider.SecurityGroupsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroups") } mg.Spec.ForProvider.SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupsRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.FileSystemIDRef, - Selector: mg.Spec.InitProvider.FileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.FileSystemIDRef, + Selector: mg.Spec.InitProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FileSystemID") } mg.Spec.InitProvider.FileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.FileSystemIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupsRefs, - Selector: mg.Spec.InitProvider.SecurityGroupsSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupsRefs, + Selector: mg.Spec.InitProvider.SecurityGroupsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroups") } mg.Spec.InitProvider.SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupsRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } @@ -293,37 +434,58 @@ func (mg *MountTarget) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this ReplicationConfiguration. func (mg *ReplicationConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceFileSystemID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SourceFileSystemIDRef, - Selector: mg.Spec.ForProvider.SourceFileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceFileSystemID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SourceFileSystemIDRef, + Selector: mg.Spec.ForProvider.SourceFileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceFileSystemID") } mg.Spec.ForProvider.SourceFileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceFileSystemIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceFileSystemID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SourceFileSystemIDRef, - Selector: mg.Spec.InitProvider.SourceFileSystemIDSelector, - To: reference.To{ - List: &FileSystemList{}, - Managed: &FileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "FileSystem", + "FileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceFileSystemID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SourceFileSystemIDRef, + Selector: mg.Spec.InitProvider.SourceFileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceFileSystemID") } diff --git a/apis/eks/v1beta1/zz_generated.resolvers.go b/apis/eks/v1beta1/zz_generated.resolvers.go index 173ba32026..5a9fcd595c 100644 --- a/apis/eks/v1beta1/zz_generated.resolvers.go +++ b/apis/eks/v1beta1/zz_generated.resolvers.go @@ -10,77 +10,120 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Addon. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Addon. func (mg *Addon) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterNameRef, - Selector: mg.Spec.ForProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterNameRef, + Selector: mg.Spec.ForProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterName") } mg.Spec.ForProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceAccountRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceAccountRoleArnRef, - Selector: mg.Spec.ForProvider.ServiceAccountRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceAccountRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceAccountRoleArnRef, + Selector: mg.Spec.ForProvider.ServiceAccountRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceAccountRoleArn") } mg.Spec.ForProvider.ServiceAccountRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServiceAccountRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterNameRef, - Selector: mg.Spec.InitProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterNameRef, + Selector: mg.Spec.InitProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterName") } mg.Spec.InitProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceAccountRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceAccountRoleArnRef, - Selector: mg.Spec.InitProvider.ServiceAccountRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceAccountRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceAccountRoleArnRef, + Selector: mg.Spec.InitProvider.ServiceAccountRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceAccountRoleArn") } @@ -92,22 +135,35 @@ func (mg *Addon) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } @@ -115,16 +171,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds") } @@ -133,16 +199,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SubnetIds") } @@ -150,16 +226,27 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs = mrsp.ResolvedReferences } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -167,16 +254,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds") } @@ -185,16 +282,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SubnetIds") } @@ -208,21 +315,33 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ClusterAuth. func (mg *ClusterAuth) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: mg.Spec.ForProvider.ClusterName, - Extract: ExternalNameIfClusterActive(), - Reference: mg.Spec.ForProvider.ClusterNameRef, - Selector: mg.Spec.ForProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: mg.Spec.ForProvider.ClusterName, + Extract: ExternalNameIfClusterActive(), + Reference: mg.Spec.ForProvider.ClusterNameRef, + Selector: mg.Spec.ForProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterName") } @@ -234,102 +353,161 @@ func (mg *ClusterAuth) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this FargateProfile. func (mg *FargateProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterNameRef, - Selector: mg.Spec.ForProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterNameRef, + Selector: mg.Spec.ForProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterName") } mg.Spec.ForProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PodExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.PodExecutionRoleArnRef, - Selector: mg.Spec.ForProvider.PodExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PodExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.PodExecutionRoleArnRef, + Selector: mg.Spec.ForProvider.PodExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PodExecutionRoleArn") } mg.Spec.ForProvider.PodExecutionRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PodExecutionRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterNameRef, - Selector: mg.Spec.InitProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterNameRef, + Selector: mg.Spec.InitProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterName") } mg.Spec.InitProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PodExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.PodExecutionRoleArnRef, - Selector: mg.Spec.InitProvider.PodExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PodExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.PodExecutionRoleArnRef, + Selector: mg.Spec.InitProvider.PodExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PodExecutionRoleArn") } mg.Spec.InitProvider.PodExecutionRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PodExecutionRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } @@ -341,37 +519,58 @@ func (mg *FargateProfile) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this IdentityProviderConfig. func (mg *IdentityProviderConfig) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterNameRef, - Selector: mg.Spec.ForProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterNameRef, + Selector: mg.Spec.ForProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterName") } mg.Spec.ForProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterNameRef, - Selector: mg.Spec.InitProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterNameRef, + Selector: mg.Spec.InitProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterName") } @@ -383,38 +582,60 @@ func (mg *IdentityProviderConfig) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this NodeGroup. func (mg *NodeGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), - Extract: ExternalNameIfClusterActive(), - Reference: mg.Spec.ForProvider.ClusterNameRef, - Selector: mg.Spec.ForProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), + Extract: ExternalNameIfClusterActive(), + Reference: mg.Spec.ForProvider.ClusterNameRef, + Selector: mg.Spec.ForProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterName") } mg.Spec.ForProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NodeRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.NodeRoleArnRef, - Selector: mg.Spec.ForProvider.NodeRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NodeRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.NodeRoleArnRef, + Selector: mg.Spec.ForProvider.NodeRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NodeRoleArn") } @@ -422,16 +643,26 @@ func (mg *NodeGroup) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.ForProvider.NodeRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.RemoteAccess); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.RemoteAccess[i3].SourceSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.RemoteAccess[i3].SourceSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.RemoteAccess[i3].SourceSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.RemoteAccess[i3].SourceSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.RemoteAccess[i3].SourceSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.RemoteAccess[i3].SourceSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RemoteAccess[i3].SourceSecurityGroupIds") } @@ -439,48 +670,77 @@ func (mg *NodeGroup) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.ForProvider.RemoteAccess[i3].SourceSecurityGroupIDRefs = mrsp.ResolvedReferences } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Version), - Extract: resource.ExtractParamPath("version", false), - Reference: mg.Spec.ForProvider.VersionRef, - Selector: mg.Spec.ForProvider.VersionSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Version), + Extract: resource.ExtractParamPath("version", false), + Reference: mg.Spec.ForProvider.VersionRef, + Selector: mg.Spec.ForProvider.VersionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Version") } mg.Spec.ForProvider.Version = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VersionRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NodeRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.NodeRoleArnRef, - Selector: mg.Spec.InitProvider.NodeRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NodeRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.NodeRoleArnRef, + Selector: mg.Spec.InitProvider.NodeRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NodeRoleArn") } @@ -488,16 +748,26 @@ func (mg *NodeGroup) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.InitProvider.NodeRoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.RemoteAccess); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.RemoteAccess[i3].SourceSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.RemoteAccess[i3].SourceSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.RemoteAccess[i3].SourceSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.RemoteAccess[i3].SourceSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.RemoteAccess[i3].SourceSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.RemoteAccess[i3].SourceSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RemoteAccess[i3].SourceSecurityGroupIds") } @@ -505,32 +775,51 @@ func (mg *NodeGroup) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.InitProvider.RemoteAccess[i3].SourceSecurityGroupIDRefs = mrsp.ResolvedReferences } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } mg.Spec.InitProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("eks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Version), - Extract: resource.ExtractParamPath("version", false), - Reference: mg.Spec.InitProvider.VersionRef, - Selector: mg.Spec.InitProvider.VersionSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Version), + Extract: resource.ExtractParamPath("version", false), + Reference: mg.Spec.InitProvider.VersionRef, + Selector: mg.Spec.InitProvider.VersionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Version") } diff --git a/apis/elasticache/v1beta1/zz_generated.resolvers.go b/apis/elasticache/v1beta1/zz_generated.resolvers.go index a41c653175..21e03e12e5 100644 --- a/apis/elasticache/v1beta1/zz_generated.resolvers.go +++ b/apis/elasticache/v1beta1/zz_generated.resolvers.go @@ -10,141 +10,218 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Cluster. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ParameterGroupNameRef, - Selector: mg.Spec.ForProvider.ParameterGroupNameSelector, - To: reference.To{ - List: &ParameterGroupList{}, - Managed: &ParameterGroup{}, - }, - }) + "ParameterGroup", + + "ParameterGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ParameterGroupNameRef, + Selector: mg.Spec.ForProvider.ParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ParameterGroupName") } mg.Spec.ForProvider.ParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ParameterGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicationGroupID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ReplicationGroupIDRef, - Selector: mg.Spec.ForProvider.ReplicationGroupIDSelector, - To: reference.To{ - List: &ReplicationGroupList{}, - Managed: &ReplicationGroup{}, - }, - }) + "ReplicationGroup", + + "ReplicationGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicationGroupID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ReplicationGroupIDRef, + Selector: mg.Spec.ForProvider.ReplicationGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ReplicationGroupID") } mg.Spec.ForProvider.ReplicationGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ReplicationGroupIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetGroupNameRef, - Selector: mg.Spec.ForProvider.SubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + "SubnetGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetGroupNameRef, + Selector: mg.Spec.ForProvider.SubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetGroupName") } mg.Spec.ForProvider.SubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", + + "ParameterGroup", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ParameterGroupNameRef, - Selector: mg.Spec.InitProvider.ParameterGroupNameSelector, - To: reference.To{ - List: &ParameterGroupList{}, - Managed: &ParameterGroup{}, - }, - }) + "ParameterGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ParameterGroupNameRef, + Selector: mg.Spec.InitProvider.ParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ParameterGroupName") } mg.Spec.InitProvider.ParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ParameterGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicationGroupID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ReplicationGroupIDRef, - Selector: mg.Spec.InitProvider.ReplicationGroupIDSelector, - To: reference.To{ - List: &ReplicationGroupList{}, - Managed: &ReplicationGroup{}, - }, - }) + "ReplicationGroup", + + "ReplicationGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicationGroupID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ReplicationGroupIDRef, + Selector: mg.Spec.InitProvider.ReplicationGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ReplicationGroupID") } mg.Spec.InitProvider.ReplicationGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ReplicationGroupIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetGroupNameRef, - Selector: mg.Spec.InitProvider.SubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + "SubnetGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetGroupNameRef, + Selector: mg.Spec.InitProvider.SubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetGroupName") } @@ -156,102 +233,157 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ReplicationGroup. func (mg *ReplicationGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetGroupNameRef, - Selector: mg.Spec.ForProvider.SubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + "SubnetGroup", + + "SubnetGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetGroupNameRef, + Selector: mg.Spec.ForProvider.SubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetGroupName") } mg.Spec.ForProvider.SubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetGroupNameRef, - Selector: mg.Spec.InitProvider.SubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + "v1beta1", + + "SubnetGroup", + + "SubnetGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetGroupNameRef, + Selector: mg.Spec.InitProvider.SubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetGroupName") } @@ -263,37 +395,58 @@ func (mg *ReplicationGroup) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this SubnetGroup. func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } @@ -305,37 +458,56 @@ func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this UserGroup. func (mg *UserGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.UserIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.UserIDRefs, - Selector: mg.Spec.ForProvider.UserIDSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", + + "User", "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.UserIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.UserIDRefs, + Selector: mg.Spec.ForProvider.UserIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserIds") } mg.Spec.ForProvider.UserIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.UserIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.UserIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.UserIDRefs, - Selector: mg.Spec.InitProvider.UserIDSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elasticache.aws.upbound.io", + + "v1beta1", + + "User", "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.UserIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.UserIDRefs, + Selector: mg.Spec.InitProvider.UserIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserIds") } diff --git a/apis/elasticbeanstalk/v1beta1/zz_generated.resolvers.go b/apis/elasticbeanstalk/v1beta1/zz_generated.resolvers.go index 304c84fb36..a8d8fe436f 100644 --- a/apis/elasticbeanstalk/v1beta1/zz_generated.resolvers.go +++ b/apis/elasticbeanstalk/v1beta1/zz_generated.resolvers.go @@ -10,29 +10,45 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Application. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Application. func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.AppversionLifecycle); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppversionLifecycle[i3].ServiceRole), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.AppversionLifecycle[i3].ServiceRoleRef, - Selector: mg.Spec.ForProvider.AppversionLifecycle[i3].ServiceRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppversionLifecycle[i3].ServiceRole), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.AppversionLifecycle[i3].ServiceRoleRef, + Selector: mg.Spec.ForProvider.AppversionLifecycle[i3].ServiceRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AppversionLifecycle[i3].ServiceRole") } @@ -41,16 +57,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.AppversionLifecycle); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AppversionLifecycle[i3].ServiceRole), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.AppversionLifecycle[i3].ServiceRoleRef, - Selector: mg.Spec.InitProvider.AppversionLifecycle[i3].ServiceRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AppversionLifecycle[i3].ServiceRole), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.AppversionLifecycle[i3].ServiceRoleRef, + Selector: mg.Spec.InitProvider.AppversionLifecycle[i3].ServiceRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AppversionLifecycle[i3].ServiceRole") } @@ -64,69 +91,108 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this ApplicationVersion. func (mg *ApplicationVersion) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &v1beta11.BucketList{}, - Managed: &v1beta11.Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Key), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.KeyRef, - Selector: mg.Spec.ForProvider.KeySelector, - To: reference.To{ - List: &v1beta11.ObjectList{}, - Managed: &v1beta11.Object{}, - }, - }) + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Key), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.KeyRef, + Selector: mg.Spec.ForProvider.KeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Key") } mg.Spec.ForProvider.Key = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KeyRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &v1beta11.BucketList{}, - Managed: &v1beta11.Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } mg.Spec.InitProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Key), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.KeyRef, - Selector: mg.Spec.InitProvider.KeySelector, - To: reference.To{ - List: &v1beta11.ObjectList{}, - Managed: &v1beta11.Object{}, - }, - }) + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Key), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.KeyRef, + Selector: mg.Spec.InitProvider.KeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Key") } @@ -138,37 +204,56 @@ func (mg *ApplicationVersion) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this ConfigurationTemplate. func (mg *ConfigurationTemplate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elasticbeanstalk.aws.upbound.io", + + "v1beta1", + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Application), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ApplicationRef, - Selector: mg.Spec.ForProvider.ApplicationSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Application), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ApplicationRef, + Selector: mg.Spec.ForProvider.ApplicationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Application") } mg.Spec.ForProvider.Application = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApplicationRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elasticbeanstalk.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Application), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ApplicationRef, - Selector: mg.Spec.InitProvider.ApplicationSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "v1beta1", + "Application", + + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Application), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ApplicationRef, + Selector: mg.Spec.InitProvider.ApplicationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Application") } diff --git a/apis/elasticsearch/v1beta1/zz_generated.resolvers.go b/apis/elasticsearch/v1beta1/zz_generated.resolvers.go index eeb4a7a445..9a67fcbea5 100644 --- a/apis/elasticsearch/v1beta1/zz_generated.resolvers.go +++ b/apis/elasticsearch/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Domain. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Domain. func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.LogPublishingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnRef, - Selector: mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnSelector, - To: reference.To{ - List: &v1beta1.GroupList{}, - Managed: &v1beta1.Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnRef, + Selector: mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn") } @@ -40,16 +56,26 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.LogPublishingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnRef, - Selector: mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnSelector, - To: reference.To{ - List: &v1beta1.GroupList{}, - Managed: &v1beta1.Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnRef, + Selector: mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn") } @@ -63,37 +89,58 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this DomainPolicy. func (mg *DomainPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elasticsearch.aws.upbound.io", + + "v1beta1", + "Domain", + + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DomainNameRef, - Selector: mg.Spec.ForProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DomainNameRef, + Selector: mg.Spec.ForProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainName") } mg.Spec.ForProvider.DomainName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elasticsearch.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DomainNameRef, - Selector: mg.Spec.InitProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "v1beta1", + "Domain", + + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DomainNameRef, + Selector: mg.Spec.InitProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainName") } diff --git a/apis/elastictranscoder/v1beta1/zz_generated.resolvers.go b/apis/elastictranscoder/v1beta1/zz_generated.resolvers.go index 13ab349d0b..e1d9f953db 100644 --- a/apis/elastictranscoder/v1beta1/zz_generated.resolvers.go +++ b/apis/elastictranscoder/v1beta1/zz_generated.resolvers.go @@ -10,29 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Pipeline. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Pipeline. func (mg *Pipeline) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.ContentConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ContentConfig[i3].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ContentConfig[i3].BucketRef, - Selector: mg.Spec.ForProvider.ContentConfig[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ContentConfig[i3].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ContentConfig[i3].BucketRef, + Selector: mg.Spec.ForProvider.ContentConfig[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ContentConfig[i3].Bucket") } @@ -40,32 +55,52 @@ func (mg *Pipeline) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.ContentConfig[i3].BucketRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InputBucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InputBucketRef, - Selector: mg.Spec.ForProvider.InputBucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InputBucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InputBucketRef, + Selector: mg.Spec.ForProvider.InputBucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InputBucket") } mg.Spec.ForProvider.InputBucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InputBucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RoleRef, - Selector: mg.Spec.ForProvider.RoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RoleRef, + Selector: mg.Spec.ForProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Role") } @@ -73,16 +108,26 @@ func (mg *Pipeline) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.RoleRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.ThumbnailConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ThumbnailConfig[i3].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ThumbnailConfig[i3].BucketRef, - Selector: mg.Spec.ForProvider.ThumbnailConfig[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ThumbnailConfig[i3].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ThumbnailConfig[i3].BucketRef, + Selector: mg.Spec.ForProvider.ThumbnailConfig[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ThumbnailConfig[i3].Bucket") } @@ -91,16 +136,26 @@ func (mg *Pipeline) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.ContentConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ContentConfig[i3].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ContentConfig[i3].BucketRef, - Selector: mg.Spec.InitProvider.ContentConfig[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ContentConfig[i3].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ContentConfig[i3].BucketRef, + Selector: mg.Spec.InitProvider.ContentConfig[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ContentConfig[i3].Bucket") } @@ -108,32 +163,52 @@ func (mg *Pipeline) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.ContentConfig[i3].BucketRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InputBucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InputBucketRef, - Selector: mg.Spec.InitProvider.InputBucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InputBucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InputBucketRef, + Selector: mg.Spec.InitProvider.InputBucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InputBucket") } mg.Spec.InitProvider.InputBucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.InputBucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RoleRef, - Selector: mg.Spec.InitProvider.RoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RoleRef, + Selector: mg.Spec.InitProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Role") } @@ -141,16 +216,26 @@ func (mg *Pipeline) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.RoleRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.ThumbnailConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ThumbnailConfig[i3].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ThumbnailConfig[i3].BucketRef, - Selector: mg.Spec.InitProvider.ThumbnailConfig[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ThumbnailConfig[i3].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ThumbnailConfig[i3].BucketRef, + Selector: mg.Spec.InitProvider.ThumbnailConfig[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ThumbnailConfig[i3].Bucket") } diff --git a/apis/elb/v1beta1/zz_generated.resolvers.go b/apis/elb/v1beta1/zz_generated.resolvers.go index f415baa1cc..065965a8d3 100644 --- a/apis/elb/v1beta1/zz_generated.resolvers.go +++ b/apis/elb/v1beta1/zz_generated.resolvers.go @@ -10,27 +10,41 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AppCookieStickinessPolicy. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this AppCookieStickinessPolicy. func (mg *AppCookieStickinessPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoadBalancerRef, - Selector: mg.Spec.ForProvider.LoadBalancerSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoadBalancerRef, + Selector: mg.Spec.ForProvider.LoadBalancerSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancer") } @@ -42,69 +56,106 @@ func (mg *AppCookieStickinessPolicy) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this Attachment. func (mg *Attachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ELB), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ELBRef, - Selector: mg.Spec.ForProvider.ELBSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ELB), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ELBRef, + Selector: mg.Spec.ForProvider.ELBSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ELB") } mg.Spec.ForProvider.ELB = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ELBRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Instance), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.InstanceRef, - Selector: mg.Spec.ForProvider.InstanceSelector, - To: reference.To{ - List: &v1beta1.InstanceList{}, - Managed: &v1beta1.Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Instance), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.InstanceRef, + Selector: mg.Spec.ForProvider.InstanceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Instance") } mg.Spec.ForProvider.Instance = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ELB), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ELBRef, - Selector: mg.Spec.InitProvider.ELBSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ELB), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ELBRef, + Selector: mg.Spec.InitProvider.ELBSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ELB") } mg.Spec.InitProvider.ELB = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ELBRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Instance), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.InstanceRef, - Selector: mg.Spec.InitProvider.InstanceSelector, - To: reference.To{ - List: &v1beta1.InstanceList{}, - Managed: &v1beta1.Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Instance), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.InstanceRef, + Selector: mg.Spec.InitProvider.InstanceSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Instance") } @@ -116,37 +167,56 @@ func (mg *Attachment) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this BackendServerPolicy. func (mg *BackendServerPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoadBalancerNameRef, - Selector: mg.Spec.ForProvider.LoadBalancerNameSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoadBalancerNameRef, + Selector: mg.Spec.ForProvider.LoadBalancerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancerName") } mg.Spec.ForProvider.LoadBalancerName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LoadBalancerNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoadBalancerNameRef, - Selector: mg.Spec.InitProvider.LoadBalancerNameSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoadBalancerNameRef, + Selector: mg.Spec.InitProvider.LoadBalancerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancerName") } @@ -158,69 +228,108 @@ func (mg *BackendServerPolicy) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this ELB. func (mg *ELB) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Instances), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.InstancesRefs, - Selector: mg.Spec.ForProvider.InstancesSelector, - To: reference.To{ - List: &v1beta1.InstanceList{}, - Managed: &v1beta1.Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Instances), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.InstancesRefs, + Selector: mg.Spec.ForProvider.InstancesSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Instances") } mg.Spec.ForProvider.Instances = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.InstancesRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Subnets), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetsRefs, - Selector: mg.Spec.ForProvider.SubnetsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Subnets), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetsRefs, + Selector: mg.Spec.ForProvider.SubnetsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Subnets") } mg.Spec.ForProvider.Subnets = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetsRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Instances), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.InstancesRefs, - Selector: mg.Spec.InitProvider.InstancesSelector, - To: reference.To{ - List: &v1beta1.InstanceList{}, - Managed: &v1beta1.Instance{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Instances), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.InstancesRefs, + Selector: mg.Spec.InitProvider.InstancesSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Instances") } mg.Spec.InitProvider.Instances = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.InstancesRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Subnets), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetsRefs, - Selector: mg.Spec.InitProvider.SubnetsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Subnets), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetsRefs, + Selector: mg.Spec.InitProvider.SubnetsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Subnets") } @@ -232,37 +341,56 @@ func (mg *ELB) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this LBCookieStickinessPolicy. func (mg *LBCookieStickinessPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.LoadBalancerRef, - Selector: mg.Spec.ForProvider.LoadBalancerSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.LoadBalancerRef, + Selector: mg.Spec.ForProvider.LoadBalancerSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancer") } mg.Spec.ForProvider.LoadBalancer = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LoadBalancerRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancer), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.LoadBalancerRef, - Selector: mg.Spec.InitProvider.LoadBalancerSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancer), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.LoadBalancerRef, + Selector: mg.Spec.InitProvider.LoadBalancerSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancer") } @@ -274,37 +402,56 @@ func (mg *LBCookieStickinessPolicy) ResolveReferences(ctx context.Context, c cli // ResolveReferences of this LBSSLNegotiationPolicy. func (mg *LBSSLNegotiationPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.LoadBalancerRef, - Selector: mg.Spec.ForProvider.LoadBalancerSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.LoadBalancerRef, + Selector: mg.Spec.ForProvider.LoadBalancerSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancer") } mg.Spec.ForProvider.LoadBalancer = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LoadBalancerRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancer), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.LoadBalancerRef, - Selector: mg.Spec.InitProvider.LoadBalancerSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancer), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.LoadBalancerRef, + Selector: mg.Spec.InitProvider.LoadBalancerSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancer") } @@ -316,37 +463,56 @@ func (mg *LBSSLNegotiationPolicy) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this ListenerPolicy. func (mg *ListenerPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoadBalancerNameRef, - Selector: mg.Spec.ForProvider.LoadBalancerNameSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoadBalancerNameRef, + Selector: mg.Spec.ForProvider.LoadBalancerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancerName") } mg.Spec.ForProvider.LoadBalancerName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LoadBalancerNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoadBalancerNameRef, - Selector: mg.Spec.InitProvider.LoadBalancerNameSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoadBalancerNameRef, + Selector: mg.Spec.InitProvider.LoadBalancerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancerName") } @@ -358,21 +524,32 @@ func (mg *ListenerPolicy) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this Policy. func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoadBalancerNameRef, - Selector: mg.Spec.ForProvider.LoadBalancerNameSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoadBalancerNameRef, + Selector: mg.Spec.ForProvider.LoadBalancerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancerName") } @@ -380,16 +557,26 @@ func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.LoadBalancerNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.PolicyAttribute); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyAttribute[i3].Value), - Extract: resource.ExtractParamPath("policy_name", false), - Reference: mg.Spec.ForProvider.PolicyAttribute[i3].ValueRef, - Selector: mg.Spec.ForProvider.PolicyAttribute[i3].ValueSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyAttribute[i3].Value), + Extract: resource.ExtractParamPath("policy_name", false), + Reference: mg.Spec.ForProvider.PolicyAttribute[i3].ValueRef, + Selector: mg.Spec.ForProvider.PolicyAttribute[i3].ValueSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PolicyAttribute[i3].Value") } @@ -397,16 +584,25 @@ func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.PolicyAttribute[i3].ValueRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoadBalancerNameRef, - Selector: mg.Spec.InitProvider.LoadBalancerNameSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoadBalancerNameRef, + Selector: mg.Spec.InitProvider.LoadBalancerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancerName") } @@ -414,16 +610,26 @@ func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.LoadBalancerNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.PolicyAttribute); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyAttribute[i3].Value), - Extract: resource.ExtractParamPath("policy_name", false), - Reference: mg.Spec.InitProvider.PolicyAttribute[i3].ValueRef, - Selector: mg.Spec.InitProvider.PolicyAttribute[i3].ValueSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyAttribute[i3].Value), + Extract: resource.ExtractParamPath("policy_name", false), + Reference: mg.Spec.InitProvider.PolicyAttribute[i3].ValueRef, + Selector: mg.Spec.InitProvider.PolicyAttribute[i3].ValueSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PolicyAttribute[i3].Value") } @@ -437,37 +643,56 @@ func (mg *Policy) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ProxyProtocolPolicy. func (mg *ProxyProtocolPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoadBalancerRef, - Selector: mg.Spec.ForProvider.LoadBalancerSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancer), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoadBalancerRef, + Selector: mg.Spec.ForProvider.LoadBalancerSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancer") } mg.Spec.ForProvider.LoadBalancer = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LoadBalancerRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elb.aws.upbound.io", + + "v1beta1", + + "ELB", "ELBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancer), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoadBalancerRef, - Selector: mg.Spec.InitProvider.LoadBalancerSelector, - To: reference.To{ - List: &ELBList{}, - Managed: &ELB{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancer), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoadBalancerRef, + Selector: mg.Spec.InitProvider.LoadBalancerSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancer") } diff --git a/apis/elbv2/v1beta1/zz_generated.resolvers.go b/apis/elbv2/v1beta1/zz_generated.resolvers.go index ace47afb2f..3004adc3ae 100644 --- a/apis/elbv2/v1beta1/zz_generated.resolvers.go +++ b/apis/elbv2/v1beta1/zz_generated.resolvers.go @@ -10,15 +10,18 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/acm/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this LB. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this LB. func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -26,16 +29,26 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.AccessLogs); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AccessLogs[i3].Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AccessLogs[i3].BucketRef, - Selector: mg.Spec.ForProvider.AccessLogs[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AccessLogs[i3].Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AccessLogs[i3].BucketRef, + Selector: mg.Spec.ForProvider.AccessLogs[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AccessLogs[i3].Bucket") } @@ -43,16 +56,26 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.AccessLogs[i3].BucketRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupRefs, - Selector: mg.Spec.ForProvider.SecurityGroupSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupRefs, + Selector: mg.Spec.ForProvider.SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroups") } @@ -60,16 +83,26 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.SecurityGroupRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.ForProvider.SubnetMapping); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetMapping[i3].SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetMapping[i3].SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetMapping[i3].SubnetID") } @@ -77,16 +110,26 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Subnets), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetRefs, - Selector: mg.Spec.ForProvider.SubnetSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Subnets), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetRefs, + Selector: mg.Spec.ForProvider.SubnetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Subnets") } @@ -94,16 +137,26 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.SubnetRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.InitProvider.AccessLogs); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AccessLogs[i3].Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.AccessLogs[i3].BucketRef, - Selector: mg.Spec.InitProvider.AccessLogs[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AccessLogs[i3].Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.AccessLogs[i3].BucketRef, + Selector: mg.Spec.InitProvider.AccessLogs[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AccessLogs[i3].Bucket") } @@ -111,16 +164,26 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.InitProvider.AccessLogs[i3].BucketRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupRefs, - Selector: mg.Spec.InitProvider.SecurityGroupSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupRefs, + Selector: mg.Spec.InitProvider.SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroups") } @@ -128,16 +191,26 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.InitProvider.SecurityGroupRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.InitProvider.SubnetMapping); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetMapping[i3].SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetMapping[i3].SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetMapping[i3].SubnetID") } @@ -145,16 +218,26 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Subnets), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetRefs, - Selector: mg.Spec.InitProvider.SubnetSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Subnets), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetRefs, + Selector: mg.Spec.InitProvider.SubnetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Subnets") } @@ -166,6 +249,9 @@ func (mg *LB) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this LBListener. func (mg *LBListener) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -174,16 +260,27 @@ func (mg *LBListener) ResolveReferences(ctx context.Context, c client.Reader) er for i3 := 0; i3 < len(mg.Spec.ForProvider.DefaultAction); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.DefaultAction[i3].Forward); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.DefaultAction[i3].Forward[i4].TargetGroup); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].Arn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].ArnRef, - Selector: mg.Spec.ForProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].ArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].Arn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].ArnRef, + Selector: mg.Spec.ForProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].Arn") } @@ -194,16 +291,27 @@ func (mg *LBListener) ResolveReferences(ctx context.Context, c client.Reader) er } } for i3 := 0; i3 < len(mg.Spec.ForProvider.DefaultAction); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultAction[i3].TargetGroupArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DefaultAction[i3].TargetGroupArnRef, - Selector: mg.Spec.ForProvider.DefaultAction[i3].TargetGroupArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultAction[i3].TargetGroupArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DefaultAction[i3].TargetGroupArnRef, + Selector: mg.Spec.ForProvider.DefaultAction[i3].TargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultAction[i3].TargetGroupArn") } @@ -211,16 +319,25 @@ func (mg *LBListener) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.ForProvider.DefaultAction[i3].TargetGroupArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoadBalancerArnRef, - Selector: mg.Spec.ForProvider.LoadBalancerArnSelector, - To: reference.To{ - List: &LBList{}, - Managed: &LB{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LB", + "LBList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoadBalancerArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoadBalancerArnRef, + Selector: mg.Spec.ForProvider.LoadBalancerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoadBalancerArn") } @@ -230,16 +347,27 @@ func (mg *LBListener) ResolveReferences(ctx context.Context, c client.Reader) er for i3 := 0; i3 < len(mg.Spec.InitProvider.DefaultAction); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.DefaultAction[i3].Forward); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.DefaultAction[i3].Forward[i4].TargetGroup); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].Arn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].ArnRef, - Selector: mg.Spec.InitProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].ArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].Arn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].ArnRef, + Selector: mg.Spec.InitProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultAction[i3].Forward[i4].TargetGroup[i5].Arn") } @@ -250,16 +378,27 @@ func (mg *LBListener) ResolveReferences(ctx context.Context, c client.Reader) er } } for i3 := 0; i3 < len(mg.Spec.InitProvider.DefaultAction); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultAction[i3].TargetGroupArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DefaultAction[i3].TargetGroupArnRef, - Selector: mg.Spec.InitProvider.DefaultAction[i3].TargetGroupArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultAction[i3].TargetGroupArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DefaultAction[i3].TargetGroupArnRef, + Selector: mg.Spec.InitProvider.DefaultAction[i3].TargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultAction[i3].TargetGroupArn") } @@ -267,16 +406,25 @@ func (mg *LBListener) ResolveReferences(ctx context.Context, c client.Reader) er mg.Spec.InitProvider.DefaultAction[i3].TargetGroupArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoadBalancerArnRef, - Selector: mg.Spec.InitProvider.LoadBalancerArnSelector, - To: reference.To{ - List: &LBList{}, - Managed: &LB{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LB", + "LBList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoadBalancerArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoadBalancerArnRef, + Selector: mg.Spec.InitProvider.LoadBalancerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoadBalancerArn") } @@ -288,69 +436,108 @@ func (mg *LBListener) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this LBListenerCertificate. func (mg *LBListenerCertificate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CertificateArnRef, - Selector: mg.Spec.ForProvider.CertificateArnSelector, - To: reference.To{ - List: &v1beta12.CertificateList{}, - Managed: &v1beta12.Certificate{}, - }, - }) + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CertificateArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CertificateArnRef, + Selector: mg.Spec.ForProvider.CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CertificateArn") } mg.Spec.ForProvider.CertificateArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CertificateArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ListenerArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ListenerArnRef, - Selector: mg.Spec.ForProvider.ListenerArnSelector, - To: reference.To{ - List: &LBListenerList{}, - Managed: &LBListener{}, - }, - }) + "v1beta1", + + "LBListener", + "LBListenerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ListenerArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ListenerArnRef, + Selector: mg.Spec.ForProvider.ListenerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ListenerArn") } mg.Spec.ForProvider.ListenerArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ListenerArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.CertificateArnRef, - Selector: mg.Spec.InitProvider.CertificateArnSelector, - To: reference.To{ - List: &v1beta12.CertificateList{}, - Managed: &v1beta12.Certificate{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CertificateArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.CertificateArnRef, + Selector: mg.Spec.InitProvider.CertificateArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CertificateArn") } mg.Spec.InitProvider.CertificateArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CertificateArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBListener", + "LBListenerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ListenerArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ListenerArnRef, - Selector: mg.Spec.InitProvider.ListenerArnSelector, - To: reference.To{ - List: &LBListenerList{}, - Managed: &LBListener{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ListenerArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ListenerArnRef, + Selector: mg.Spec.InitProvider.ListenerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ListenerArn") } @@ -362,6 +549,9 @@ func (mg *LBListenerCertificate) ResolveReferences(ctx context.Context, c client // ResolveReferences of this LBListenerRule. func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -369,16 +559,27 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.ForProvider.Action); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Action[i3].AuthenticateCognito); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolArnRef, - Selector: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolArnSelector, - To: reference.To{ - List: &v1beta13.UserPoolList{}, - Managed: &v1beta13.UserPool{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolArnRef, + Selector: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolArn") } @@ -389,16 +590,26 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.Action); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Action[i3].AuthenticateCognito); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientIDRef, - Selector: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientIDSelector, - To: reference.To{ - List: &v1beta13.UserPoolClientList{}, - Managed: &v1beta13.UserPoolClient{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientIDRef, + Selector: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientID") } @@ -409,16 +620,26 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.Action); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Action[i3].AuthenticateCognito); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomain), - Extract: resource.ExtractParamPath("domain", false), - Reference: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomainRef, - Selector: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomainSelector, - To: reference.To{ - List: &v1beta13.UserPoolDomainList{}, - Managed: &v1beta13.UserPoolDomain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolDomain", + + "UserPoolDomainList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomain), + Extract: resource.ExtractParamPath("domain", false), + Reference: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomainRef, + Selector: mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomainSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomain") } @@ -430,16 +651,27 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.ForProvider.Action); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Action[i3].Forward); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Action[i3].Forward[i4].TargetGroup); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].Forward[i4].TargetGroup[i5].Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Action[i3].Forward[i4].TargetGroup[i5].ArnRef, - Selector: mg.Spec.ForProvider.Action[i3].Forward[i4].TargetGroup[i5].ArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].Forward[i4].TargetGroup[i5].Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Action[i3].Forward[i4].TargetGroup[i5].ArnRef, + Selector: mg.Spec.ForProvider.Action[i3].Forward[i4].TargetGroup[i5].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Action[i3].Forward[i4].TargetGroup[i5].Arn") } @@ -450,16 +682,27 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.ForProvider.Action); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].TargetGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Action[i3].TargetGroupArnRef, - Selector: mg.Spec.ForProvider.Action[i3].TargetGroupArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Action[i3].TargetGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Action[i3].TargetGroupArnRef, + Selector: mg.Spec.ForProvider.Action[i3].TargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Action[i3].TargetGroupArn") } @@ -467,16 +710,26 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader mg.Spec.ForProvider.Action[i3].TargetGroupArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ListenerArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ListenerArnRef, - Selector: mg.Spec.ForProvider.ListenerArnSelector, - To: reference.To{ - List: &LBListenerList{}, - Managed: &LBListener{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBListener", + "LBListenerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ListenerArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ListenerArnRef, + Selector: mg.Spec.ForProvider.ListenerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ListenerArn") } @@ -485,16 +738,27 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.InitProvider.Action); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Action[i3].AuthenticateCognito); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolArnRef, - Selector: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolArnSelector, - To: reference.To{ - List: &v1beta13.UserPoolList{}, - Managed: &v1beta13.UserPool{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPool", + + "UserPoolList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolArnRef, + Selector: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolArn") } @@ -505,16 +769,26 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.Action); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Action[i3].AuthenticateCognito); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientIDRef, - Selector: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientIDSelector, - To: reference.To{ - List: &v1beta13.UserPoolClientList{}, - Managed: &v1beta13.UserPoolClient{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientIDRef, + Selector: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolClientID") } @@ -525,16 +799,26 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.Action); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Action[i3].AuthenticateCognito); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomain), - Extract: resource.ExtractParamPath("domain", false), - Reference: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomainRef, - Selector: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomainSelector, - To: reference.To{ - List: &v1beta13.UserPoolDomainList{}, - Managed: &v1beta13.UserPoolDomain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolDomain", + + "UserPoolDomainList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomain), + Extract: resource.ExtractParamPath("domain", false), + Reference: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomainRef, + Selector: mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomainSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Action[i3].AuthenticateCognito[i4].UserPoolDomain") } @@ -546,16 +830,27 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.InitProvider.Action); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Action[i3].Forward); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Action[i3].Forward[i4].TargetGroup); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].Forward[i4].TargetGroup[i5].Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Action[i3].Forward[i4].TargetGroup[i5].ArnRef, - Selector: mg.Spec.InitProvider.Action[i3].Forward[i4].TargetGroup[i5].ArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].Forward[i4].TargetGroup[i5].Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Action[i3].Forward[i4].TargetGroup[i5].ArnRef, + Selector: mg.Spec.InitProvider.Action[i3].Forward[i4].TargetGroup[i5].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Action[i3].Forward[i4].TargetGroup[i5].Arn") } @@ -566,16 +861,27 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.InitProvider.Action); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].TargetGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Action[i3].TargetGroupArnRef, - Selector: mg.Spec.InitProvider.Action[i3].TargetGroupArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Action[i3].TargetGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Action[i3].TargetGroupArnRef, + Selector: mg.Spec.InitProvider.Action[i3].TargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Action[i3].TargetGroupArn") } @@ -583,16 +889,26 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader mg.Spec.InitProvider.Action[i3].TargetGroupArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ListenerArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ListenerArnRef, - Selector: mg.Spec.InitProvider.ListenerArnSelector, - To: reference.To{ - List: &LBListenerList{}, - Managed: &LBListener{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBListener", + "LBListenerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ListenerArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ListenerArnRef, + Selector: mg.Spec.InitProvider.ListenerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ListenerArn") } @@ -604,37 +920,56 @@ func (mg *LBListenerRule) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this LBTargetGroup. func (mg *LBTargetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -646,37 +981,60 @@ func (mg *LBTargetGroup) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this LBTargetGroupAttachment. func (mg *LBTargetGroupAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetGroupArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TargetGroupArnRef, - Selector: mg.Spec.ForProvider.TargetGroupArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetGroupArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TargetGroupArnRef, + Selector: mg.Spec.ForProvider.TargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetGroupArn") } mg.Spec.ForProvider.TargetGroupArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetGroupArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("elbv2.aws.upbound.io", + + "v1beta1", + + "LBTargetGroup", + + "LBTargetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetGroupArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TargetGroupArnRef, - Selector: mg.Spec.InitProvider.TargetGroupArnSelector, - To: reference.To{ - List: &LBTargetGroupList{}, - Managed: &LBTargetGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetGroupArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TargetGroupArnRef, + Selector: mg.Spec.InitProvider.TargetGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetGroupArn") } diff --git a/apis/evidently/v1beta1/zz_generated.resolvers.go b/apis/evidently/v1beta1/zz_generated.resolvers.go index 2b7f943314..4e529166ce 100644 --- a/apis/evidently/v1beta1/zz_generated.resolvers.go +++ b/apis/evidently/v1beta1/zz_generated.resolvers.go @@ -8,28 +8,43 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Feature. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Feature. func (mg *Feature) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("evidently.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Project), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.ProjectRef, - Selector: mg.Spec.ForProvider.ProjectSelector, - To: reference.To{ - List: &ProjectList{}, - Managed: &Project{}, - }, - }) + "Project", + "ProjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Project), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.ProjectRef, + Selector: mg.Spec.ForProvider.ProjectSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Project") } diff --git a/apis/firehose/v1beta1/zz_generated.resolvers.go b/apis/firehose/v1beta1/zz_generated.resolvers.go index a0fb284c8f..4e3534043a 100644 --- a/apis/firehose/v1beta1/zz_generated.resolvers.go +++ b/apis/firehose/v1beta1/zz_generated.resolvers.go @@ -10,33 +10,45 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/elasticsearch/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/glue/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/opensearch/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this DeliveryStream. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this DeliveryStream. func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.ElasticsearchConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].DomainArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].DomainArnRef, - Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].DomainArnSelector, - To: reference.To{ - List: &v1beta1.DomainList{}, - Managed: &v1beta1.Domain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elasticsearch.aws.upbound.io", + + "v1beta1", + "Domain", + + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].DomainArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].DomainArnRef, + Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].DomainArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ElasticsearchConfiguration[i3].DomainArn") } @@ -45,16 +57,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.ElasticsearchConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ElasticsearchConfiguration[i3].RoleArn") } @@ -64,16 +87,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.ElasticsearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -84,16 +117,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.ElasticsearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -104,16 +148,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.ElasticsearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].VPCConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArn") } @@ -123,16 +178,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.ForProvider.ExtendedS3Configuration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtendedS3Configuration[i3].BucketArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ExtendedS3Configuration[i3].BucketArnRef, - Selector: mg.Spec.ForProvider.ExtendedS3Configuration[i3].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtendedS3Configuration[i3].BucketArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ExtendedS3Configuration[i3].BucketArnRef, + Selector: mg.Spec.ForProvider.ExtendedS3Configuration[i3].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExtendedS3Configuration[i3].BucketArn") } @@ -143,16 +208,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.ForProvider.ExtendedS3Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArnRef, - Selector: mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArnRef, + Selector: mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArn") } @@ -165,16 +241,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.ForProvider.ExtendedS3Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableNameRef, - Selector: mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableNameSelector, - To: reference.To{ - List: &v1beta13.CatalogTableList{}, - Managed: &v1beta13.CatalogTable{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogTable", + "CatalogTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableNameRef, + Selector: mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableName") } @@ -185,16 +271,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.ForProvider.ExtendedS3Configuration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtendedS3Configuration[i3].RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ExtendedS3Configuration[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.ExtendedS3Configuration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExtendedS3Configuration[i3].RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ExtendedS3Configuration[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.ExtendedS3Configuration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExtendedS3Configuration[i3].RoleArn") } @@ -203,16 +300,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.HTTPEndpointConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].RoleArn") } @@ -222,16 +330,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.HTTPEndpointConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -242,16 +360,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.HTTPEndpointConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -261,16 +390,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.ForProvider.OpensearchConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].DomainArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].DomainArnRef, - Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].DomainArnSelector, - To: reference.To{ - List: &v1beta14.DomainList{}, - Managed: &v1beta14.Domain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("opensearch.aws.upbound.io", + + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].DomainArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].DomainArnRef, + Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].DomainArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OpensearchConfiguration[i3].DomainArn") } @@ -279,16 +418,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.OpensearchConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OpensearchConfiguration[i3].RoleArn") } @@ -298,16 +448,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.OpensearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -318,16 +478,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.OpensearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -338,16 +509,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.OpensearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.OpensearchConfiguration[i3].VPCConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArn") } @@ -357,16 +539,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.ForProvider.OpensearchserverlessConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].RoleArn") } @@ -376,16 +569,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.OpensearchserverlessConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -396,16 +599,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.OpensearchserverlessConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -415,16 +629,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.ForProvider.RedshiftConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RedshiftConfiguration[i3].RoleArn") } @@ -434,16 +659,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.RedshiftConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArnRef, - Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArnRef, + Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArn") } @@ -454,16 +689,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.RedshiftConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArn") } @@ -474,16 +720,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.RedshiftConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -494,16 +750,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.RedshiftConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -514,16 +781,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.SplunkConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -534,16 +811,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.SplunkConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -553,16 +841,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.InitProvider.ElasticsearchConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].DomainArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].DomainArnRef, - Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].DomainArnSelector, - To: reference.To{ - List: &v1beta1.DomainList{}, - Managed: &v1beta1.Domain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("elasticsearch.aws.upbound.io", + + "v1beta1", + "Domain", + + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].DomainArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].DomainArnRef, + Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].DomainArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ElasticsearchConfiguration[i3].DomainArn") } @@ -571,16 +869,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.ElasticsearchConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ElasticsearchConfiguration[i3].RoleArn") } @@ -590,16 +899,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.ElasticsearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -610,16 +929,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.ElasticsearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ElasticsearchConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -630,16 +960,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.ElasticsearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].VPCConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ElasticsearchConfiguration[i3].VPCConfig[i4].RoleArn") } @@ -649,16 +990,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.InitProvider.ExtendedS3Configuration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtendedS3Configuration[i3].BucketArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ExtendedS3Configuration[i3].BucketArnRef, - Selector: mg.Spec.InitProvider.ExtendedS3Configuration[i3].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtendedS3Configuration[i3].BucketArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ExtendedS3Configuration[i3].BucketArnRef, + Selector: mg.Spec.InitProvider.ExtendedS3Configuration[i3].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExtendedS3Configuration[i3].BucketArn") } @@ -669,16 +1020,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.InitProvider.ExtendedS3Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArnRef, - Selector: mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArnRef, + Selector: mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].RoleArn") } @@ -691,16 +1053,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.InitProvider.ExtendedS3Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableNameRef, - Selector: mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableNameSelector, - To: reference.To{ - List: &v1beta13.CatalogTableList{}, - Managed: &v1beta13.CatalogTable{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogTable", + "CatalogTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableNameRef, + Selector: mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExtendedS3Configuration[i3].DataFormatConversionConfiguration[i4].SchemaConfiguration[i5].TableName") } @@ -711,16 +1083,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.InitProvider.ExtendedS3Configuration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtendedS3Configuration[i3].RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ExtendedS3Configuration[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.ExtendedS3Configuration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExtendedS3Configuration[i3].RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ExtendedS3Configuration[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.ExtendedS3Configuration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExtendedS3Configuration[i3].RoleArn") } @@ -729,16 +1112,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.HTTPEndpointConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].RoleArn") } @@ -748,16 +1142,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.HTTPEndpointConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -768,16 +1172,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.HTTPEndpointConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HTTPEndpointConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -787,16 +1202,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.InitProvider.OpensearchConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].DomainArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].DomainArnRef, - Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].DomainArnSelector, - To: reference.To{ - List: &v1beta14.DomainList{}, - Managed: &v1beta14.Domain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("opensearch.aws.upbound.io", + + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].DomainArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].DomainArnRef, + Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].DomainArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OpensearchConfiguration[i3].DomainArn") } @@ -805,16 +1230,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.OpensearchConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OpensearchConfiguration[i3].RoleArn") } @@ -824,16 +1260,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.OpensearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -844,16 +1290,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.OpensearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OpensearchConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -864,16 +1321,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.OpensearchConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.OpensearchConfiguration[i3].VPCConfig); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OpensearchConfiguration[i3].VPCConfig[i4].RoleArn") } @@ -883,16 +1351,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.InitProvider.OpensearchserverlessConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].RoleArn") } @@ -902,16 +1381,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.OpensearchserverlessConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -922,16 +1411,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.OpensearchserverlessConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OpensearchserverlessConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -941,16 +1441,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } } for i3 := 0; i3 < len(mg.Spec.InitProvider.RedshiftConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RedshiftConfiguration[i3].RoleArn") } @@ -960,16 +1471,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.RedshiftConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArnRef, - Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArnRef, + Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].BucketArn") } @@ -980,16 +1501,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.RedshiftConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RedshiftConfiguration[i3].S3BackupConfiguration[i4].RoleArn") } @@ -1000,16 +1532,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.RedshiftConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -1020,16 +1562,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.RedshiftConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RedshiftConfiguration[i3].S3Configuration[i4].RoleArn") } @@ -1040,16 +1593,26 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.SplunkConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArnRef, - Selector: mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArnSelector, - To: reference.To{ - List: &v1beta12.BucketList{}, - Managed: &v1beta12.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArnRef, + Selector: mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].BucketArn") } @@ -1060,16 +1623,27 @@ func (mg *DeliveryStream) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.SplunkConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SplunkConfiguration[i3].S3Configuration[i4].RoleArn") } diff --git a/apis/fis/v1beta1/zz_generated.resolvers.go b/apis/fis/v1beta1/zz_generated.resolvers.go index f9438d3d18..4ced4dbd2d 100644 --- a/apis/fis/v1beta1/zz_generated.resolvers.go +++ b/apis/fis/v1beta1/zz_generated.resolvers.go @@ -9,44 +9,70 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ExperimentTemplate. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ExperimentTemplate. func (mg *ExperimentTemplate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/fsx/v1beta1/zz_generated.resolvers.go b/apis/fsx/v1beta1/zz_generated.resolvers.go index 9b129e5977..902efe9d00 100644 --- a/apis/fsx/v1beta1/zz_generated.resolvers.go +++ b/apis/fsx/v1beta1/zz_generated.resolvers.go @@ -10,46 +10,70 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/ds/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + common "github.com/upbound/provider-aws/config/common" + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Backup. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this Backup. func (mg *Backup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.FileSystemIDRef, - Selector: mg.Spec.ForProvider.FileSystemIDSelector, - To: reference.To{ - List: &LustreFileSystemList{}, - Managed: &LustreFileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("fsx.aws.upbound.io", + + "v1beta1", + + "LustreFileSystem", + + "LustreFileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.FileSystemIDRef, + Selector: mg.Spec.ForProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FileSystemID") } mg.Spec.ForProvider.FileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FileSystemIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.FileSystemIDRef, - Selector: mg.Spec.InitProvider.FileSystemIDSelector, - To: reference.To{ - List: &LustreFileSystemList{}, - Managed: &LustreFileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("fsx.aws.upbound.io", + + "v1beta1", + + "LustreFileSystem", + + "LustreFileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.FileSystemIDRef, + Selector: mg.Spec.InitProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FileSystemID") } @@ -61,37 +85,60 @@ func (mg *Backup) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this DataRepositoryAssociation. func (mg *DataRepositoryAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.FileSystemIDRef, - Selector: mg.Spec.ForProvider.FileSystemIDSelector, - To: reference.To{ - List: &LustreFileSystemList{}, - Managed: &LustreFileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("fsx.aws.upbound.io", + + "v1beta1", + + "LustreFileSystem", + + "LustreFileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.FileSystemIDRef, + Selector: mg.Spec.ForProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FileSystemID") } mg.Spec.ForProvider.FileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FileSystemIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.FileSystemIDRef, - Selector: mg.Spec.InitProvider.FileSystemIDSelector, - To: reference.To{ - List: &LustreFileSystemList{}, - Managed: &LustreFileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("fsx.aws.upbound.io", + + "v1beta1", + + "LustreFileSystem", + + "LustreFileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.FileSystemIDRef, + Selector: mg.Spec.InitProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FileSystemID") } @@ -103,102 +150,157 @@ func (mg *DataRepositoryAssociation) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this LustreFileSystem. func (mg *LustreFileSystem) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } @@ -210,134 +312,207 @@ func (mg *LustreFileSystem) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this OntapFileSystem. func (mg *OntapFileSystem) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PreferredSubnetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PreferredSubnetIDRef, - Selector: mg.Spec.ForProvider.PreferredSubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PreferredSubnetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PreferredSubnetIDRef, + Selector: mg.Spec.ForProvider.PreferredSubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PreferredSubnetID") } mg.Spec.ForProvider.PreferredSubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PreferredSubnetIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PreferredSubnetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PreferredSubnetIDRef, - Selector: mg.Spec.InitProvider.PreferredSubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PreferredSubnetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PreferredSubnetIDRef, + Selector: mg.Spec.InitProvider.PreferredSubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PreferredSubnetID") } mg.Spec.InitProvider.PreferredSubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PreferredSubnetIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } @@ -349,37 +524,60 @@ func (mg *OntapFileSystem) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this OntapStorageVirtualMachine. func (mg *OntapStorageVirtualMachine) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.FileSystemIDRef, - Selector: mg.Spec.ForProvider.FileSystemIDSelector, - To: reference.To{ - List: &OntapFileSystemList{}, - Managed: &OntapFileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("fsx.aws.upbound.io", + + "v1beta1", + + "OntapFileSystem", + + "OntapFileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.FileSystemIDRef, + Selector: mg.Spec.ForProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FileSystemID") } mg.Spec.ForProvider.FileSystemID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FileSystemIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.FileSystemIDRef, - Selector: mg.Spec.InitProvider.FileSystemIDSelector, - To: reference.To{ - List: &OntapFileSystemList{}, - Managed: &OntapFileSystem{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("fsx.aws.upbound.io", + + "v1beta1", + + "OntapFileSystem", + + "OntapFileSystemList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.FileSystemIDRef, + Selector: mg.Spec.InitProvider.FileSystemIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FileSystemID") } @@ -391,134 +589,207 @@ func (mg *OntapStorageVirtualMachine) ResolveReferences(ctx context.Context, c c // ResolveReferences of this WindowsFileSystem. func (mg *WindowsFileSystem) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ActiveDirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ActiveDirectoryIDRef, - Selector: mg.Spec.ForProvider.ActiveDirectoryIDSelector, - To: reference.To{ - List: &v1beta12.DirectoryList{}, - Managed: &v1beta12.Directory{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ActiveDirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ActiveDirectoryIDRef, + Selector: mg.Spec.ForProvider.ActiveDirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ActiveDirectoryID") } mg.Spec.ForProvider.ActiveDirectoryID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ActiveDirectoryIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ActiveDirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ActiveDirectoryIDRef, - Selector: mg.Spec.InitProvider.ActiveDirectoryIDSelector, - To: reference.To{ - List: &v1beta12.DirectoryList{}, - Managed: &v1beta12.Directory{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ActiveDirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ActiveDirectoryIDRef, + Selector: mg.Spec.InitProvider.ActiveDirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ActiveDirectoryID") } mg.Spec.InitProvider.ActiveDirectoryID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ActiveDirectoryIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/gamelift/v1beta1/zz_generated.resolvers.go b/apis/gamelift/v1beta1/zz_generated.resolvers.go index d5cedb8044..9f9c32b528 100644 --- a/apis/gamelift/v1beta1/zz_generated.resolvers.go +++ b/apis/gamelift/v1beta1/zz_generated.resolvers.go @@ -10,31 +10,45 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Build. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Build. func (mg *Build) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.StorageLocation[i3].BucketRef, - Selector: mg.Spec.ForProvider.StorageLocation[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.StorageLocation[i3].BucketRef, + Selector: mg.Spec.ForProvider.StorageLocation[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageLocation[i3].Bucket") } @@ -43,16 +57,26 @@ func (mg *Build) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].Key), - Extract: resource.ExtractParamPath("key", false), - Reference: mg.Spec.ForProvider.StorageLocation[i3].KeyRef, - Selector: mg.Spec.ForProvider.StorageLocation[i3].KeySelector, - To: reference.To{ - List: &v1beta1.ObjectList{}, - Managed: &v1beta1.Object{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].Key), + Extract: resource.ExtractParamPath("key", false), + Reference: mg.Spec.ForProvider.StorageLocation[i3].KeyRef, + Selector: mg.Spec.ForProvider.StorageLocation[i3].KeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageLocation[i3].Key") } @@ -61,16 +85,27 @@ func (mg *Build) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.StorageLocation[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.StorageLocation[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.StorageLocation[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.StorageLocation[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageLocation[i3].RoleArn") } @@ -79,16 +114,26 @@ func (mg *Build) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.StorageLocation[i3].BucketRef, - Selector: mg.Spec.InitProvider.StorageLocation[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.StorageLocation[i3].BucketRef, + Selector: mg.Spec.InitProvider.StorageLocation[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageLocation[i3].Bucket") } @@ -97,16 +142,26 @@ func (mg *Build) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].Key), - Extract: resource.ExtractParamPath("key", false), - Reference: mg.Spec.InitProvider.StorageLocation[i3].KeyRef, - Selector: mg.Spec.InitProvider.StorageLocation[i3].KeySelector, - To: reference.To{ - List: &v1beta1.ObjectList{}, - Managed: &v1beta1.Object{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].Key), + Extract: resource.ExtractParamPath("key", false), + Reference: mg.Spec.InitProvider.StorageLocation[i3].KeyRef, + Selector: mg.Spec.InitProvider.StorageLocation[i3].KeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageLocation[i3].Key") } @@ -115,16 +170,27 @@ func (mg *Build) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.StorageLocation[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.StorageLocation[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.StorageLocation[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.StorageLocation[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageLocation[i3].RoleArn") } @@ -138,69 +204,110 @@ func (mg *Build) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this Fleet. func (mg *Fleet) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("gamelift.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BuildID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.BuildIDRef, - Selector: mg.Spec.ForProvider.BuildIDSelector, - To: reference.To{ - List: &BuildList{}, - Managed: &Build{}, - }, - }) + "Build", + "BuildList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BuildID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.BuildIDRef, + Selector: mg.Spec.ForProvider.BuildIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BuildID") } mg.Spec.ForProvider.BuildID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BuildIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.InstanceRoleArnRef, - Selector: mg.Spec.ForProvider.InstanceRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.InstanceRoleArnRef, + Selector: mg.Spec.ForProvider.InstanceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceRoleArn") } mg.Spec.ForProvider.InstanceRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("gamelift.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BuildID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.BuildIDRef, - Selector: mg.Spec.InitProvider.BuildIDSelector, - To: reference.To{ - List: &BuildList{}, - Managed: &Build{}, - }, - }) + "Build", + "BuildList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BuildID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.BuildIDRef, + Selector: mg.Spec.InitProvider.BuildIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BuildID") } mg.Spec.InitProvider.BuildID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BuildIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.InstanceRoleArnRef, - Selector: mg.Spec.InitProvider.InstanceRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.InstanceRoleArnRef, + Selector: mg.Spec.InitProvider.InstanceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceRoleArn") } @@ -212,37 +319,58 @@ func (mg *Fleet) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this GameSessionQueue. func (mg *GameSessionQueue) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NotificationTarget), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.NotificationTargetRef, - Selector: mg.Spec.ForProvider.NotificationTargetSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NotificationTarget), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.NotificationTargetRef, + Selector: mg.Spec.ForProvider.NotificationTargetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NotificationTarget") } mg.Spec.ForProvider.NotificationTarget = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NotificationTargetRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NotificationTarget), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.NotificationTargetRef, - Selector: mg.Spec.InitProvider.NotificationTargetSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NotificationTarget), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.NotificationTargetRef, + Selector: mg.Spec.InitProvider.NotificationTargetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NotificationTarget") } @@ -254,22 +382,35 @@ func (mg *GameSessionQueue) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this Script. func (mg *Script) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.StorageLocation[i3].BucketRef, - Selector: mg.Spec.ForProvider.StorageLocation[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.StorageLocation[i3].BucketRef, + Selector: mg.Spec.ForProvider.StorageLocation[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageLocation[i3].Bucket") } @@ -278,16 +419,26 @@ func (mg *Script) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].Key), - Extract: resource.ExtractParamPath("key", false), - Reference: mg.Spec.ForProvider.StorageLocation[i3].KeyRef, - Selector: mg.Spec.ForProvider.StorageLocation[i3].KeySelector, - To: reference.To{ - List: &v1beta1.ObjectList{}, - Managed: &v1beta1.Object{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].Key), + Extract: resource.ExtractParamPath("key", false), + Reference: mg.Spec.ForProvider.StorageLocation[i3].KeyRef, + Selector: mg.Spec.ForProvider.StorageLocation[i3].KeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageLocation[i3].Key") } @@ -296,16 +447,27 @@ func (mg *Script) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.StorageLocation[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.StorageLocation[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLocation[i3].RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.StorageLocation[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.StorageLocation[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageLocation[i3].RoleArn") } @@ -314,16 +476,26 @@ func (mg *Script) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.StorageLocation[i3].BucketRef, - Selector: mg.Spec.InitProvider.StorageLocation[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.StorageLocation[i3].BucketRef, + Selector: mg.Spec.InitProvider.StorageLocation[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageLocation[i3].Bucket") } @@ -332,16 +504,26 @@ func (mg *Script) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].Key), - Extract: resource.ExtractParamPath("key", false), - Reference: mg.Spec.InitProvider.StorageLocation[i3].KeyRef, - Selector: mg.Spec.InitProvider.StorageLocation[i3].KeySelector, - To: reference.To{ - List: &v1beta1.ObjectList{}, - Managed: &v1beta1.Object{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].Key), + Extract: resource.ExtractParamPath("key", false), + Reference: mg.Spec.InitProvider.StorageLocation[i3].KeyRef, + Selector: mg.Spec.InitProvider.StorageLocation[i3].KeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageLocation[i3].Key") } @@ -350,16 +532,27 @@ func (mg *Script) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.StorageLocation[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.StorageLocation[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLocation[i3].RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.StorageLocation[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.StorageLocation[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageLocation[i3].RoleArn") } diff --git a/apis/glacier/v1beta1/zz_generated.resolvers.go b/apis/glacier/v1beta1/zz_generated.resolvers.go index 9863168a5c..8ad6a204d0 100644 --- a/apis/glacier/v1beta1/zz_generated.resolvers.go +++ b/apis/glacier/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Vault. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this Vault. func (mg *Vault) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Notification); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Notification[i3].SnsTopic), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Notification[i3].SnsTopicRef, - Selector: mg.Spec.ForProvider.Notification[i3].SnsTopicSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Notification[i3].SnsTopic), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Notification[i3].SnsTopicRef, + Selector: mg.Spec.ForProvider.Notification[i3].SnsTopicSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Notification[i3].SnsTopic") } @@ -40,16 +56,26 @@ func (mg *Vault) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.InitProvider.Notification); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Notification[i3].SnsTopic), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Notification[i3].SnsTopicRef, - Selector: mg.Spec.InitProvider.Notification[i3].SnsTopicSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Notification[i3].SnsTopic), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Notification[i3].SnsTopicRef, + Selector: mg.Spec.InitProvider.Notification[i3].SnsTopicSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Notification[i3].SnsTopic") } @@ -63,37 +89,58 @@ func (mg *Vault) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this VaultLock. func (mg *VaultLock) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("glacier.aws.upbound.io", + + "v1beta1", + + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VaultNameRef, - Selector: mg.Spec.ForProvider.VaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VaultNameRef, + Selector: mg.Spec.ForProvider.VaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VaultName") } mg.Spec.ForProvider.VaultName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VaultNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("glacier.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VaultName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VaultNameRef, - Selector: mg.Spec.InitProvider.VaultNameSelector, - To: reference.To{ - List: &VaultList{}, - Managed: &Vault{}, - }, - }) + "v1beta1", + + "Vault", + "VaultList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VaultName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VaultNameRef, + Selector: mg.Spec.InitProvider.VaultNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VaultName") } diff --git a/apis/globalaccelerator/v1beta1/zz_generated.resolvers.go b/apis/globalaccelerator/v1beta1/zz_generated.resolvers.go index 8e78080060..42d5f3727a 100644 --- a/apis/globalaccelerator/v1beta1/zz_generated.resolvers.go +++ b/apis/globalaccelerator/v1beta1/zz_generated.resolvers.go @@ -8,43 +8,65 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this EndpointGroup. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this EndpointGroup. func (mg *EndpointGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("globalaccelerator.aws.upbound.io", + + "v1beta1", + "Listener", + + "ListenerList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ListenerArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ListenerArnRef, - Selector: mg.Spec.ForProvider.ListenerArnSelector, - To: reference.To{ - List: &ListenerList{}, - Managed: &Listener{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ListenerArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ListenerArnRef, + Selector: mg.Spec.ForProvider.ListenerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ListenerArn") } mg.Spec.ForProvider.ListenerArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ListenerArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("globalaccelerator.aws.upbound.io", + + "v1beta1", + "Listener", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ListenerArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ListenerArnRef, - Selector: mg.Spec.InitProvider.ListenerArnSelector, - To: reference.To{ - List: &ListenerList{}, - Managed: &Listener{}, - }, - }) + "ListenerList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ListenerArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ListenerArnRef, + Selector: mg.Spec.InitProvider.ListenerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ListenerArn") } @@ -56,37 +78,56 @@ func (mg *EndpointGroup) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Listener. func (mg *Listener) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("globalaccelerator.aws.upbound.io", + + "v1beta1", + "Accelerator", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AcceleratorArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AcceleratorArnRef, - Selector: mg.Spec.ForProvider.AcceleratorArnSelector, - To: reference.To{ - List: &AcceleratorList{}, - Managed: &Accelerator{}, - }, - }) + "AcceleratorList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AcceleratorArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AcceleratorArnRef, + Selector: mg.Spec.ForProvider.AcceleratorArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AcceleratorArn") } mg.Spec.ForProvider.AcceleratorArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AcceleratorArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("globalaccelerator.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AcceleratorArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.AcceleratorArnRef, - Selector: mg.Spec.InitProvider.AcceleratorArnSelector, - To: reference.To{ - List: &AcceleratorList{}, - Managed: &Accelerator{}, - }, - }) + "v1beta1", + "Accelerator", + + "AcceleratorList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AcceleratorArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.AcceleratorArnRef, + Selector: mg.Spec.InitProvider.AcceleratorArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AcceleratorArn") } diff --git a/apis/glue/v1beta1/zz_generated.resolvers.go b/apis/glue/v1beta1/zz_generated.resolvers.go index c566061020..89eed0d12c 100644 --- a/apis/glue/v1beta1/zz_generated.resolvers.go +++ b/apis/glue/v1beta1/zz_generated.resolvers.go @@ -10,30 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this CatalogTable. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this CatalogTable. func (mg *CatalogTable) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogDatabase", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DatabaseName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DatabaseNameRef, - Selector: mg.Spec.ForProvider.DatabaseNameSelector, - To: reference.To{ - List: &CatalogDatabaseList{}, - Managed: &CatalogDatabase{}, - }, - }) + "CatalogDatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DatabaseName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DatabaseNameRef, + Selector: mg.Spec.ForProvider.DatabaseNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DatabaseName") } @@ -45,22 +59,35 @@ func (mg *CatalogTable) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Connection. func (mg *Connection) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.PhysicalConnectionRequirements); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].AvailabilityZone), - Extract: resource.ExtractParamPath("availability_zone", false), - Reference: mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].AvailabilityZoneRef, - Selector: mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].AvailabilityZoneSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].AvailabilityZone), + Extract: resource.ExtractParamPath("availability_zone", false), + Reference: mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].AvailabilityZoneRef, + Selector: mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].AvailabilityZoneSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].AvailabilityZone") } @@ -69,16 +96,26 @@ func (mg *Connection) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.ForProvider.PhysicalConnectionRequirements); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].SubnetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].SubnetIDRef, - Selector: mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].SubnetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].SubnetIDRef, + Selector: mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PhysicalConnectionRequirements[i3].SubnetID") } @@ -87,16 +124,26 @@ func (mg *Connection) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.InitProvider.PhysicalConnectionRequirements); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].AvailabilityZone), - Extract: resource.ExtractParamPath("availability_zone", false), - Reference: mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].AvailabilityZoneRef, - Selector: mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].AvailabilityZoneSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].AvailabilityZone), + Extract: resource.ExtractParamPath("availability_zone", false), + Reference: mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].AvailabilityZoneRef, + Selector: mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].AvailabilityZoneSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].AvailabilityZone") } @@ -105,16 +152,26 @@ func (mg *Connection) ResolveReferences(ctx context.Context, c client.Reader) er } for i3 := 0; i3 < len(mg.Spec.InitProvider.PhysicalConnectionRequirements); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].SubnetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].SubnetIDRef, - Selector: mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].SubnetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].SubnetIDRef, + Selector: mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PhysicalConnectionRequirements[i3].SubnetID") } @@ -128,22 +185,36 @@ func (mg *Connection) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Crawler. func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.CatalogTarget); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CatalogTarget[i3].DatabaseName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CatalogTarget[i3].DatabaseNameRef, - Selector: mg.Spec.ForProvider.CatalogTarget[i3].DatabaseNameSelector, - To: reference.To{ - List: &CatalogDatabaseList{}, - Managed: &CatalogDatabase{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogDatabase", + + "CatalogDatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CatalogTarget[i3].DatabaseName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CatalogTarget[i3].DatabaseNameRef, + Selector: mg.Spec.ForProvider.CatalogTarget[i3].DatabaseNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CatalogTarget[i3].DatabaseName") } @@ -151,16 +222,27 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.CatalogTarget[i3].DatabaseNameRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DatabaseName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DatabaseNameRef, - Selector: mg.Spec.ForProvider.DatabaseNameSelector, - To: reference.To{ - List: &CatalogDatabaseList{}, - Managed: &CatalogDatabase{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogDatabase", + + "CatalogDatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DatabaseName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DatabaseNameRef, + Selector: mg.Spec.ForProvider.DatabaseNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DatabaseName") } @@ -168,16 +250,26 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.DatabaseNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.JdbcTarget); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.JdbcTarget[i3].ConnectionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.JdbcTarget[i3].ConnectionNameRef, - Selector: mg.Spec.ForProvider.JdbcTarget[i3].ConnectionNameSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Connection", + "ConnectionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.JdbcTarget[i3].ConnectionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.JdbcTarget[i3].ConnectionNameRef, + Selector: mg.Spec.ForProvider.JdbcTarget[i3].ConnectionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.JdbcTarget[i3].ConnectionName") } @@ -186,16 +278,26 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.MongodbTarget); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MongodbTarget[i3].ConnectionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.MongodbTarget[i3].ConnectionNameRef, - Selector: mg.Spec.ForProvider.MongodbTarget[i3].ConnectionNameSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Connection", + "ConnectionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MongodbTarget[i3].ConnectionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.MongodbTarget[i3].ConnectionNameRef, + Selector: mg.Spec.ForProvider.MongodbTarget[i3].ConnectionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MongodbTarget[i3].ConnectionName") } @@ -203,16 +305,27 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.MongodbTarget[i3].ConnectionNameRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleRef, - Selector: mg.Spec.ForProvider.RoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleRef, + Selector: mg.Spec.ForProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Role") } @@ -220,16 +333,27 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.RoleRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.CatalogTarget); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CatalogTarget[i3].DatabaseName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CatalogTarget[i3].DatabaseNameRef, - Selector: mg.Spec.InitProvider.CatalogTarget[i3].DatabaseNameSelector, - To: reference.To{ - List: &CatalogDatabaseList{}, - Managed: &CatalogDatabase{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogDatabase", + + "CatalogDatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CatalogTarget[i3].DatabaseName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CatalogTarget[i3].DatabaseNameRef, + Selector: mg.Spec.InitProvider.CatalogTarget[i3].DatabaseNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CatalogTarget[i3].DatabaseName") } @@ -237,16 +361,27 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.CatalogTarget[i3].DatabaseNameRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DatabaseName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DatabaseNameRef, - Selector: mg.Spec.InitProvider.DatabaseNameSelector, - To: reference.To{ - List: &CatalogDatabaseList{}, - Managed: &CatalogDatabase{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogDatabase", + + "CatalogDatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DatabaseName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DatabaseNameRef, + Selector: mg.Spec.InitProvider.DatabaseNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DatabaseName") } @@ -254,16 +389,26 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.DatabaseNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.JdbcTarget); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.JdbcTarget[i3].ConnectionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.JdbcTarget[i3].ConnectionNameRef, - Selector: mg.Spec.InitProvider.JdbcTarget[i3].ConnectionNameSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Connection", + "ConnectionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.JdbcTarget[i3].ConnectionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.JdbcTarget[i3].ConnectionNameRef, + Selector: mg.Spec.InitProvider.JdbcTarget[i3].ConnectionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.JdbcTarget[i3].ConnectionName") } @@ -272,16 +417,26 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.MongodbTarget); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MongodbTarget[i3].ConnectionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.MongodbTarget[i3].ConnectionNameRef, - Selector: mg.Spec.InitProvider.MongodbTarget[i3].ConnectionNameSelector, - To: reference.To{ - List: &ConnectionList{}, - Managed: &Connection{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Connection", + "ConnectionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MongodbTarget[i3].ConnectionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.MongodbTarget[i3].ConnectionNameRef, + Selector: mg.Spec.InitProvider.MongodbTarget[i3].ConnectionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MongodbTarget[i3].ConnectionName") } @@ -289,16 +444,27 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.MongodbTarget[i3].ConnectionNameRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleRef, - Selector: mg.Spec.InitProvider.RoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleRef, + Selector: mg.Spec.InitProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Role") } @@ -310,6 +476,9 @@ func (mg *Crawler) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this DataCatalogEncryptionSettings. func (mg *DataCatalogEncryptionSettings) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -317,16 +486,25 @@ func (mg *DataCatalogEncryptionSettings) ResolveReferences(ctx context.Context, for i3 := 0; i3 < len(mg.Spec.ForProvider.DataCatalogEncryptionSettings); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyIDRef, - Selector: mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyIDRef, + Selector: mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyID") } @@ -337,16 +515,25 @@ func (mg *DataCatalogEncryptionSettings) ResolveReferences(ctx context.Context, } for i3 := 0; i3 < len(mg.Spec.ForProvider.DataCatalogEncryptionSettings); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyIDRef, - Selector: mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyIDRef, + Selector: mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyID") } @@ -357,16 +544,25 @@ func (mg *DataCatalogEncryptionSettings) ResolveReferences(ctx context.Context, } for i3 := 0; i3 < len(mg.Spec.InitProvider.DataCatalogEncryptionSettings); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyIDRef, - Selector: mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyIDRef, + Selector: mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].ConnectionPasswordEncryption[i4].AwsKMSKeyID") } @@ -377,16 +573,25 @@ func (mg *DataCatalogEncryptionSettings) ResolveReferences(ctx context.Context, } for i3 := 0; i3 < len(mg.Spec.InitProvider.DataCatalogEncryptionSettings); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyIDRef, - Selector: mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyIDRef, + Selector: mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DataCatalogEncryptionSettings[i3].EncryptionAtRest[i4].SseAwsKMSKeyID") } @@ -401,37 +606,60 @@ func (mg *DataCatalogEncryptionSettings) ResolveReferences(ctx context.Context, // ResolveReferences of this Job. func (mg *Job) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -443,37 +671,58 @@ func (mg *Job) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this Schema. func (mg *Schema) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegistryArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RegistryArnRef, - Selector: mg.Spec.ForProvider.RegistryArnSelector, - To: reference.To{ - List: &RegistryList{}, - Managed: &Registry{}, - }, - }) + "Registry", + "RegistryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegistryArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RegistryArnRef, + Selector: mg.Spec.ForProvider.RegistryArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RegistryArn") } mg.Spec.ForProvider.RegistryArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RegistryArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Registry", + "RegistryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegistryArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RegistryArnRef, - Selector: mg.Spec.InitProvider.RegistryArnSelector, - To: reference.To{ - List: &RegistryList{}, - Managed: &Registry{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegistryArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RegistryArnRef, + Selector: mg.Spec.InitProvider.RegistryArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RegistryArn") } @@ -485,6 +734,9 @@ func (mg *Schema) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this SecurityConfiguration. func (mg *SecurityConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -492,16 +744,25 @@ func (mg *SecurityConfiguration) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.ForProvider.EncryptionConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.EncryptionConfiguration[i3].CloudwatchEncryption); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArnRef, - Selector: mg.Spec.ForProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArnRef, + Selector: mg.Spec.ForProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArn") } @@ -512,16 +773,25 @@ func (mg *SecurityConfiguration) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.ForProvider.EncryptionConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.EncryptionConfiguration[i3].JobBookmarksEncryption); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArnRef, - Selector: mg.Spec.ForProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArnRef, + Selector: mg.Spec.ForProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArn") } @@ -532,16 +802,25 @@ func (mg *SecurityConfiguration) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.ForProvider.EncryptionConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.EncryptionConfiguration[i3].S3Encryption); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArnRef, - Selector: mg.Spec.ForProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArnRef, + Selector: mg.Spec.ForProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArn") } @@ -552,16 +831,25 @@ func (mg *SecurityConfiguration) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.InitProvider.EncryptionConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.EncryptionConfiguration[i3].CloudwatchEncryption); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArnRef, - Selector: mg.Spec.InitProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArnRef, + Selector: mg.Spec.InitProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EncryptionConfiguration[i3].CloudwatchEncryption[i4].KMSKeyArn") } @@ -572,16 +860,25 @@ func (mg *SecurityConfiguration) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.InitProvider.EncryptionConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.EncryptionConfiguration[i3].JobBookmarksEncryption); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArnRef, - Selector: mg.Spec.InitProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArnRef, + Selector: mg.Spec.InitProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EncryptionConfiguration[i3].JobBookmarksEncryption[i4].KMSKeyArn") } @@ -592,16 +889,25 @@ func (mg *SecurityConfiguration) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.InitProvider.EncryptionConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.EncryptionConfiguration[i3].S3Encryption); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArnRef, - Selector: mg.Spec.InitProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArnRef, + Selector: mg.Spec.InitProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EncryptionConfiguration[i3].S3Encryption[i4].KMSKeyArn") } @@ -616,22 +922,35 @@ func (mg *SecurityConfiguration) ResolveReferences(ctx context.Context, c client // ResolveReferences of this Trigger. func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Actions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Actions[i3].CrawlerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.Actions[i3].CrawlerNameRef, - Selector: mg.Spec.ForProvider.Actions[i3].CrawlerNameSelector, - To: reference.To{ - List: &CrawlerList{}, - Managed: &Crawler{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Crawler", + "CrawlerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Actions[i3].CrawlerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.Actions[i3].CrawlerNameRef, + Selector: mg.Spec.ForProvider.Actions[i3].CrawlerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Actions[i3].CrawlerName") } @@ -640,16 +959,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.Actions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Actions[i3].JobName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.Actions[i3].JobNameRef, - Selector: mg.Spec.ForProvider.Actions[i3].JobNameSelector, - To: reference.To{ - List: &JobList{}, - Managed: &Job{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Job", + "JobList") + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Actions[i3].JobName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.Actions[i3].JobNameRef, + Selector: mg.Spec.ForProvider.Actions[i3].JobNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Actions[i3].JobName") } @@ -659,16 +988,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.Predicate); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Predicate[i3].Conditions); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicate[i3].Conditions[i4].CrawlerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.Predicate[i3].Conditions[i4].CrawlerNameRef, - Selector: mg.Spec.ForProvider.Predicate[i3].Conditions[i4].CrawlerNameSelector, - To: reference.To{ - List: &CrawlerList{}, - Managed: &Crawler{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Crawler", + "CrawlerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicate[i3].Conditions[i4].CrawlerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.Predicate[i3].Conditions[i4].CrawlerNameRef, + Selector: mg.Spec.ForProvider.Predicate[i3].Conditions[i4].CrawlerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Predicate[i3].Conditions[i4].CrawlerName") } @@ -679,16 +1018,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.Predicate); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Predicate[i3].Conditions); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicate[i3].Conditions[i4].JobName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.Predicate[i3].Conditions[i4].JobNameRef, - Selector: mg.Spec.ForProvider.Predicate[i3].Conditions[i4].JobNameSelector, - To: reference.To{ - List: &JobList{}, - Managed: &Job{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Job", + "JobList") + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicate[i3].Conditions[i4].JobName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.Predicate[i3].Conditions[i4].JobNameRef, + Selector: mg.Spec.ForProvider.Predicate[i3].Conditions[i4].JobNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Predicate[i3].Conditions[i4].JobName") } @@ -698,16 +1047,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error } } for i3 := 0; i3 < len(mg.Spec.InitProvider.Actions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Actions[i3].CrawlerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.Actions[i3].CrawlerNameRef, - Selector: mg.Spec.InitProvider.Actions[i3].CrawlerNameSelector, - To: reference.To{ - List: &CrawlerList{}, - Managed: &Crawler{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Crawler", + "CrawlerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Actions[i3].CrawlerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.Actions[i3].CrawlerNameRef, + Selector: mg.Spec.InitProvider.Actions[i3].CrawlerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Actions[i3].CrawlerName") } @@ -716,16 +1075,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.Actions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Actions[i3].JobName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.Actions[i3].JobNameRef, - Selector: mg.Spec.InitProvider.Actions[i3].JobNameSelector, - To: reference.To{ - List: &JobList{}, - Managed: &Job{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Job", + "JobList") + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Actions[i3].JobName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.Actions[i3].JobNameRef, + Selector: mg.Spec.InitProvider.Actions[i3].JobNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Actions[i3].JobName") } @@ -735,16 +1104,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.Predicate); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Predicate[i3].Conditions); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicate[i3].Conditions[i4].CrawlerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.Predicate[i3].Conditions[i4].CrawlerNameRef, - Selector: mg.Spec.InitProvider.Predicate[i3].Conditions[i4].CrawlerNameSelector, - To: reference.To{ - List: &CrawlerList{}, - Managed: &Crawler{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Crawler", + "CrawlerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicate[i3].Conditions[i4].CrawlerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.Predicate[i3].Conditions[i4].CrawlerNameRef, + Selector: mg.Spec.InitProvider.Predicate[i3].Conditions[i4].CrawlerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Predicate[i3].Conditions[i4].CrawlerName") } @@ -755,16 +1134,26 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.Predicate); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Predicate[i3].Conditions); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicate[i3].Conditions[i4].JobName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.Predicate[i3].Conditions[i4].JobNameRef, - Selector: mg.Spec.InitProvider.Predicate[i3].Conditions[i4].JobNameSelector, - To: reference.To{ - List: &JobList{}, - Managed: &Job{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "Job", + "JobList") + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicate[i3].Conditions[i4].JobName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.Predicate[i3].Conditions[i4].JobNameRef, + Selector: mg.Spec.InitProvider.Predicate[i3].Conditions[i4].JobNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Predicate[i3].Conditions[i4].JobName") } @@ -779,21 +1168,34 @@ func (mg *Trigger) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this UserDefinedFunction. func (mg *UserDefinedFunction) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DatabaseName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DatabaseNameRef, - Selector: mg.Spec.ForProvider.DatabaseNameSelector, - To: reference.To{ - List: &CatalogDatabaseList{}, - Managed: &CatalogDatabase{}, - }, - }) + "v1beta1", + + "CatalogDatabase", + + "CatalogDatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DatabaseName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DatabaseNameRef, + Selector: mg.Spec.ForProvider.DatabaseNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DatabaseName") } diff --git a/apis/grafana/v1beta1/zz_generated.resolvers.go b/apis/grafana/v1beta1/zz_generated.resolvers.go index e6870393ef..f6613ea44c 100644 --- a/apis/grafana/v1beta1/zz_generated.resolvers.go +++ b/apis/grafana/v1beta1/zz_generated.resolvers.go @@ -10,44 +10,68 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this LicenseAssociation. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this LicenseAssociation. func (mg *LicenseAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("grafana.aws.upbound.io", + + "v1beta1", + + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WorkspaceIDRef, - Selector: mg.Spec.ForProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WorkspaceIDRef, + Selector: mg.Spec.ForProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WorkspaceID") } mg.Spec.ForProvider.WorkspaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.WorkspaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("grafana.aws.upbound.io", + + "v1beta1", + + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.WorkspaceIDRef, - Selector: mg.Spec.InitProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.WorkspaceIDRef, + Selector: mg.Spec.InitProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WorkspaceID") } @@ -59,37 +83,58 @@ func (mg *LicenseAssociation) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this RoleAssociation. func (mg *RoleAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("grafana.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.WorkspaceIDRef, - Selector: mg.Spec.ForProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + "v1beta1", + + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.WorkspaceIDRef, + Selector: mg.Spec.ForProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WorkspaceID") } mg.Spec.ForProvider.WorkspaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.WorkspaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("grafana.aws.upbound.io", + + "v1beta1", + + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.WorkspaceIDRef, - Selector: mg.Spec.InitProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.WorkspaceIDRef, + Selector: mg.Spec.InitProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WorkspaceID") } @@ -101,37 +146,60 @@ func (mg *RoleAssociation) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this Workspace. func (mg *Workspace) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -143,37 +211,58 @@ func (mg *Workspace) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this WorkspaceAPIKey. func (mg *WorkspaceAPIKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("grafana.aws.upbound.io", + + "v1beta1", + + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WorkspaceIDRef, - Selector: mg.Spec.ForProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WorkspaceIDRef, + Selector: mg.Spec.ForProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WorkspaceID") } mg.Spec.ForProvider.WorkspaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.WorkspaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("grafana.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.WorkspaceIDRef, - Selector: mg.Spec.InitProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.WorkspaceIDRef, + Selector: mg.Spec.InitProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WorkspaceID") } @@ -185,37 +274,58 @@ func (mg *WorkspaceAPIKey) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this WorkspaceSAMLConfiguration. func (mg *WorkspaceSAMLConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("grafana.aws.upbound.io", + + "v1beta1", + + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.WorkspaceIDRef, - Selector: mg.Spec.ForProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.WorkspaceIDRef, + Selector: mg.Spec.ForProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WorkspaceID") } mg.Spec.ForProvider.WorkspaceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.WorkspaceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("grafana.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.WorkspaceIDRef, - Selector: mg.Spec.InitProvider.WorkspaceIDSelector, - To: reference.To{ - List: &WorkspaceList{}, - Managed: &Workspace{}, - }, - }) + "Workspace", + "WorkspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.WorkspaceIDRef, + Selector: mg.Spec.InitProvider.WorkspaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WorkspaceID") } diff --git a/apis/guardduty/v1beta1/zz_generated.resolvers.go b/apis/guardduty/v1beta1/zz_generated.resolvers.go index b090085b3a..b5251b8477 100644 --- a/apis/guardduty/v1beta1/zz_generated.resolvers.go +++ b/apis/guardduty/v1beta1/zz_generated.resolvers.go @@ -8,28 +8,44 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Filter. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Filter. func (mg *Filter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("guardduty.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DetectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DetectorIDRef, - Selector: mg.Spec.ForProvider.DetectorIDSelector, - To: reference.To{ - List: &DetectorList{}, - Managed: &Detector{}, - }, - }) + "Detector", + + "DetectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DetectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DetectorIDRef, + Selector: mg.Spec.ForProvider.DetectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DetectorID") } @@ -41,69 +57,112 @@ func (mg *Filter) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Member. func (mg *Member) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("guardduty.aws.upbound.io", + + "v1beta1", + + "Detector", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AccountID), - Extract: resource.ExtractParamPath("account_id", true), - Reference: mg.Spec.ForProvider.AccountIDRef, - Selector: mg.Spec.ForProvider.AccountIDSelector, - To: reference.To{ - List: &DetectorList{}, - Managed: &Detector{}, - }, - }) + "DetectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AccountID), + Extract: resource.ExtractParamPath("account_id", true), + Reference: mg.Spec.ForProvider.AccountIDRef, + Selector: mg.Spec.ForProvider.AccountIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AccountID") } mg.Spec.ForProvider.AccountID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AccountIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("guardduty.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DetectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DetectorIDRef, - Selector: mg.Spec.ForProvider.DetectorIDSelector, - To: reference.To{ - List: &DetectorList{}, - Managed: &Detector{}, - }, - }) + "Detector", + + "DetectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DetectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DetectorIDRef, + Selector: mg.Spec.ForProvider.DetectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DetectorID") } mg.Spec.ForProvider.DetectorID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DetectorIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("guardduty.aws.upbound.io", + + "v1beta1", + + "Detector", + + "DetectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AccountID), - Extract: resource.ExtractParamPath("account_id", true), - Reference: mg.Spec.InitProvider.AccountIDRef, - Selector: mg.Spec.InitProvider.AccountIDSelector, - To: reference.To{ - List: &DetectorList{}, - Managed: &Detector{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AccountID), + Extract: resource.ExtractParamPath("account_id", true), + Reference: mg.Spec.InitProvider.AccountIDRef, + Selector: mg.Spec.InitProvider.AccountIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AccountID") } mg.Spec.InitProvider.AccountID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AccountIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("guardduty.aws.upbound.io", + + "v1beta1", + + "Detector", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DetectorID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DetectorIDRef, - Selector: mg.Spec.InitProvider.DetectorIDSelector, - To: reference.To{ - List: &DetectorList{}, - Managed: &Detector{}, - }, - }) + "DetectorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DetectorID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DetectorIDRef, + Selector: mg.Spec.InitProvider.DetectorIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DetectorID") } diff --git a/apis/iam/v1beta1/zz_generated.resolvers.go b/apis/iam/v1beta1/zz_generated.resolvers.go index f435d25309..41714fc588 100644 --- a/apis/iam/v1beta1/zz_generated.resolvers.go +++ b/apis/iam/v1beta1/zz_generated.resolvers.go @@ -8,45 +8,71 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AccessKey. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this AccessKey. func (mg *AccessKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserRef, - Selector: mg.Spec.ForProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserRef, + Selector: mg.Spec.ForProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.User") } mg.Spec.ForProvider.User = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.User), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserRef, - Selector: mg.Spec.InitProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.User), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserRef, + Selector: mg.Spec.InitProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.User") } @@ -58,70 +84,111 @@ func (mg *AccessKey) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this GroupMembership. func (mg *GroupMembership) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Group), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.GroupRef, - Selector: mg.Spec.ForProvider.GroupSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Group), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.GroupRef, + Selector: mg.Spec.ForProvider.GroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Group") } mg.Spec.ForProvider.Group = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GroupRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Users), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.UserRefs, - Selector: mg.Spec.ForProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Users), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.UserRefs, + Selector: mg.Spec.ForProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Users") } mg.Spec.ForProvider.Users = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.UserRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Group), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.GroupRef, - Selector: mg.Spec.InitProvider.GroupSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Group), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.GroupRef, + Selector: mg.Spec.InitProvider.GroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Group") } mg.Spec.InitProvider.Group = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GroupRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Users), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.UserRefs, - Selector: mg.Spec.InitProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Users), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.UserRefs, + Selector: mg.Spec.InitProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Users") } @@ -133,69 +200,108 @@ func (mg *GroupMembership) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this GroupPolicyAttachment. func (mg *GroupPolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Group), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.GroupRef, - Selector: mg.Spec.ForProvider.GroupSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Group), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.GroupRef, + Selector: mg.Spec.ForProvider.GroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Group") } mg.Spec.ForProvider.Group = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GroupRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.PolicyArnRef, - Selector: mg.Spec.ForProvider.PolicyArnSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.PolicyArnRef, + Selector: mg.Spec.ForProvider.PolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PolicyArn") } mg.Spec.ForProvider.PolicyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PolicyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Group), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.GroupRef, - Selector: mg.Spec.InitProvider.GroupSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Group), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.GroupRef, + Selector: mg.Spec.InitProvider.GroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Group") } mg.Spec.InitProvider.Group = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GroupRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.PolicyArnRef, - Selector: mg.Spec.InitProvider.PolicyArnSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.PolicyArnRef, + Selector: mg.Spec.InitProvider.PolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PolicyArn") } @@ -207,37 +313,60 @@ func (mg *GroupPolicyAttachment) ResolveReferences(ctx context.Context, c client // ResolveReferences of this InstanceProfile. func (mg *InstanceProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RoleRef, - Selector: mg.Spec.ForProvider.RoleSelector, - To: reference.To{ - List: &RoleList{}, - Managed: &Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RoleRef, + Selector: mg.Spec.ForProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Role") } mg.Spec.ForProvider.Role = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RoleRef, - Selector: mg.Spec.InitProvider.RoleSelector, - To: reference.To{ - List: &RoleList{}, - Managed: &Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RoleRef, + Selector: mg.Spec.InitProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Role") } @@ -249,21 +378,34 @@ func (mg *InstanceProfile) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this RolePolicy. func (mg *RolePolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RoleRef, - Selector: mg.Spec.ForProvider.RoleSelector, - To: reference.To{ - List: &RoleList{}, - Managed: &Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RoleRef, + Selector: mg.Spec.ForProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Role") } @@ -275,69 +417,110 @@ func (mg *RolePolicy) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this RolePolicyAttachment. func (mg *RolePolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.PolicyArnRef, - Selector: mg.Spec.ForProvider.PolicyArnSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.PolicyArnRef, + Selector: mg.Spec.ForProvider.PolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PolicyArn") } mg.Spec.ForProvider.PolicyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PolicyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RoleRef, - Selector: mg.Spec.ForProvider.RoleSelector, - To: reference.To{ - List: &RoleList{}, - Managed: &Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RoleRef, + Selector: mg.Spec.ForProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Role") } mg.Spec.ForProvider.Role = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.PolicyArnRef, - Selector: mg.Spec.InitProvider.PolicyArnSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.PolicyArnRef, + Selector: mg.Spec.InitProvider.PolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PolicyArn") } mg.Spec.InitProvider.PolicyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PolicyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RoleRef, - Selector: mg.Spec.InitProvider.RoleSelector, - To: reference.To{ - List: &RoleList{}, - Managed: &Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RoleRef, + Selector: mg.Spec.InitProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Role") } @@ -349,37 +532,60 @@ func (mg *RolePolicyAttachment) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this ServiceSpecificCredential. func (mg *ServiceSpecificCredential) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserNameRef, - Selector: mg.Spec.ForProvider.UserNameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserNameRef, + Selector: mg.Spec.ForProvider.UserNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserName") } mg.Spec.ForProvider.UserName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserNameRef, - Selector: mg.Spec.InitProvider.UserNameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserNameRef, + Selector: mg.Spec.InitProvider.UserNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserName") } @@ -391,70 +597,111 @@ func (mg *ServiceSpecificCredential) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this UserGroupMembership. func (mg *UserGroupMembership) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Groups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.GroupRefs, - Selector: mg.Spec.ForProvider.GroupSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.Groups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.GroupRefs, + Selector: mg.Spec.ForProvider.GroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Groups") } mg.Spec.ForProvider.Groups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.GroupRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserRef, - Selector: mg.Spec.ForProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserRef, + Selector: mg.Spec.ForProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.User") } mg.Spec.ForProvider.User = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Groups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.GroupRefs, - Selector: mg.Spec.InitProvider.GroupSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.Groups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.GroupRefs, + Selector: mg.Spec.InitProvider.GroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Groups") } mg.Spec.InitProvider.Groups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.GroupRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.User), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserRef, - Selector: mg.Spec.InitProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.User), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserRef, + Selector: mg.Spec.InitProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.User") } @@ -466,37 +713,60 @@ func (mg *UserGroupMembership) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this UserLoginProfile. func (mg *UserLoginProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserRef, - Selector: mg.Spec.ForProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserRef, + Selector: mg.Spec.ForProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.User") } mg.Spec.ForProvider.User = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.User), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserRef, - Selector: mg.Spec.InitProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.User), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserRef, + Selector: mg.Spec.InitProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.User") } @@ -508,69 +778,110 @@ func (mg *UserLoginProfile) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this UserPolicyAttachment. func (mg *UserPolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.PolicyArnRef, - Selector: mg.Spec.ForProvider.PolicyArnSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.PolicyArnRef, + Selector: mg.Spec.ForProvider.PolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PolicyArn") } mg.Spec.ForProvider.PolicyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PolicyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserRef, - Selector: mg.Spec.ForProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserRef, + Selector: mg.Spec.ForProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.User") } mg.Spec.ForProvider.User = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.PolicyArnRef, - Selector: mg.Spec.InitProvider.PolicyArnSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.PolicyArnRef, + Selector: mg.Spec.InitProvider.PolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PolicyArn") } mg.Spec.InitProvider.PolicyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PolicyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.User), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserRef, - Selector: mg.Spec.InitProvider.UserSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.User), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserRef, + Selector: mg.Spec.InitProvider.UserSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.User") } @@ -582,37 +893,60 @@ func (mg *UserPolicyAttachment) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this UserSSHKey. func (mg *UserSSHKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Username), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UsernameRef, - Selector: mg.Spec.ForProvider.UsernameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Username), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UsernameRef, + Selector: mg.Spec.ForProvider.UsernameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Username") } mg.Spec.ForProvider.Username = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UsernameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Username), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UsernameRef, - Selector: mg.Spec.InitProvider.UsernameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Username), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UsernameRef, + Selector: mg.Spec.InitProvider.UsernameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Username") } diff --git a/apis/identitystore/v1beta1/zz_generated.resolvers.go b/apis/identitystore/v1beta1/zz_generated.resolvers.go index 214f9534b7..f745d194c4 100644 --- a/apis/identitystore/v1beta1/zz_generated.resolvers.go +++ b/apis/identitystore/v1beta1/zz_generated.resolvers.go @@ -8,76 +8,114 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this GroupMembership. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this GroupMembership. func (mg *GroupMembership) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("identitystore.aws.upbound.io", + + "v1beta1", + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GroupID), - Extract: resource.ExtractParamPath("group_id", true), - Reference: mg.Spec.ForProvider.GroupIDRef, - Selector: mg.Spec.ForProvider.GroupIDSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GroupID), + Extract: resource.ExtractParamPath("group_id", true), + Reference: mg.Spec.ForProvider.GroupIDRef, + Selector: mg.Spec.ForProvider.GroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GroupID") } mg.Spec.ForProvider.GroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("identitystore.aws.upbound.io", + + "v1beta1", + "User", + "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberID), - Extract: resource.ExtractParamPath("user_id", true), - Reference: mg.Spec.ForProvider.MemberIDRef, - Selector: mg.Spec.ForProvider.MemberIDSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberID), + Extract: resource.ExtractParamPath("user_id", true), + Reference: mg.Spec.ForProvider.MemberIDRef, + Selector: mg.Spec.ForProvider.MemberIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MemberID") } mg.Spec.ForProvider.MemberID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.MemberIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("identitystore.aws.upbound.io", + + "v1beta1", + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GroupID), - Extract: resource.ExtractParamPath("group_id", true), - Reference: mg.Spec.InitProvider.GroupIDRef, - Selector: mg.Spec.InitProvider.GroupIDSelector, - To: reference.To{ - List: &GroupList{}, - Managed: &Group{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GroupID), + Extract: resource.ExtractParamPath("group_id", true), + Reference: mg.Spec.InitProvider.GroupIDRef, + Selector: mg.Spec.InitProvider.GroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GroupID") } mg.Spec.InitProvider.GroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GroupIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("identitystore.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MemberID), - Extract: resource.ExtractParamPath("user_id", true), - Reference: mg.Spec.InitProvider.MemberIDRef, - Selector: mg.Spec.InitProvider.MemberIDSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + "v1beta1", + "User", + "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MemberID), + Extract: resource.ExtractParamPath("user_id", true), + Reference: mg.Spec.InitProvider.MemberIDRef, + Selector: mg.Spec.InitProvider.MemberIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MemberID") } diff --git a/apis/imagebuilder/v1beta1/zz_generated.resolvers.go b/apis/imagebuilder/v1beta1/zz_generated.resolvers.go index 6207f1afe9..eb9eadfb9a 100644 --- a/apis/imagebuilder/v1beta1/zz_generated.resolvers.go +++ b/apis/imagebuilder/v1beta1/zz_generated.resolvers.go @@ -10,48 +10,65 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta13 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/ecr/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/s3/v1beta1" - v1beta15 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Component. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Component. func (mg *Component) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -63,22 +80,35 @@ func (mg *Component) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this ContainerRecipe. func (mg *ContainerRecipe) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Component); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Component[i3].ComponentArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Component[i3].ComponentArnRef, - Selector: mg.Spec.ForProvider.Component[i3].ComponentArnSelector, - To: reference.To{ - List: &ComponentList{}, - Managed: &Component{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "Component", + + "ComponentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Component[i3].ComponentArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Component[i3].ComponentArnRef, + Selector: mg.Spec.ForProvider.Component[i3].ComponentArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Component[i3].ComponentArn") } @@ -86,16 +116,25 @@ func (mg *ContainerRecipe) ResolveReferences(ctx context.Context, c client.Reade mg.Spec.ForProvider.Component[i3].ComponentArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } @@ -103,16 +142,26 @@ func (mg *ContainerRecipe) ResolveReferences(ctx context.Context, c client.Reade mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.TargetRepository); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetRepository[i3].RepositoryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TargetRepository[i3].RepositoryNameRef, - Selector: mg.Spec.ForProvider.TargetRepository[i3].RepositoryNameSelector, - To: reference.To{ - List: &v1beta11.RepositoryList{}, - Managed: &v1beta11.Repository{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecr.aws.upbound.io", + + "v1beta1", + + "Repository", + "RepositoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetRepository[i3].RepositoryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TargetRepository[i3].RepositoryNameRef, + Selector: mg.Spec.ForProvider.TargetRepository[i3].RepositoryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetRepository[i3].RepositoryName") } @@ -121,16 +170,26 @@ func (mg *ContainerRecipe) ResolveReferences(ctx context.Context, c client.Reade } for i3 := 0; i3 < len(mg.Spec.InitProvider.Component); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Component[i3].ComponentArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Component[i3].ComponentArnRef, - Selector: mg.Spec.InitProvider.Component[i3].ComponentArnSelector, - To: reference.To{ - List: &ComponentList{}, - Managed: &Component{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "Component", + + "ComponentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Component[i3].ComponentArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Component[i3].ComponentArnRef, + Selector: mg.Spec.InitProvider.Component[i3].ComponentArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Component[i3].ComponentArn") } @@ -138,16 +197,25 @@ func (mg *ContainerRecipe) ResolveReferences(ctx context.Context, c client.Reade mg.Spec.InitProvider.Component[i3].ComponentArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -155,16 +223,26 @@ func (mg *ContainerRecipe) ResolveReferences(ctx context.Context, c client.Reade mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.TargetRepository); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetRepository[i3].RepositoryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TargetRepository[i3].RepositoryNameRef, - Selector: mg.Spec.InitProvider.TargetRepository[i3].RepositoryNameSelector, - To: reference.To{ - List: &v1beta11.RepositoryList{}, - Managed: &v1beta11.Repository{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ecr.aws.upbound.io", + + "v1beta1", + + "Repository", + "RepositoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetRepository[i3].RepositoryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TargetRepository[i3].RepositoryNameRef, + Selector: mg.Spec.InitProvider.TargetRepository[i3].RepositoryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetRepository[i3].RepositoryName") } @@ -178,101 +256,158 @@ func (mg *ContainerRecipe) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this Image. func (mg *Image) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "DistributionConfiguration", + + "DistributionConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DistributionConfigurationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.DistributionConfigurationArnRef, - Selector: mg.Spec.ForProvider.DistributionConfigurationArnSelector, - To: reference.To{ - List: &DistributionConfigurationList{}, - Managed: &DistributionConfiguration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DistributionConfigurationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.DistributionConfigurationArnRef, + Selector: mg.Spec.ForProvider.DistributionConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DistributionConfigurationArn") } mg.Spec.ForProvider.DistributionConfigurationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DistributionConfigurationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "ImageRecipe", + + "ImageRecipeList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ImageRecipeArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ImageRecipeArnRef, - Selector: mg.Spec.ForProvider.ImageRecipeArnSelector, - To: reference.To{ - List: &ImageRecipeList{}, - Managed: &ImageRecipe{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ImageRecipeArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ImageRecipeArnRef, + Selector: mg.Spec.ForProvider.ImageRecipeArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ImageRecipeArn") } mg.Spec.ForProvider.ImageRecipeArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ImageRecipeArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "InfrastructureConfiguration", + + "InfrastructureConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InfrastructureConfigurationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.InfrastructureConfigurationArnRef, - Selector: mg.Spec.ForProvider.InfrastructureConfigurationArnSelector, - To: reference.To{ - List: &InfrastructureConfigurationList{}, - Managed: &InfrastructureConfiguration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InfrastructureConfigurationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.InfrastructureConfigurationArnRef, + Selector: mg.Spec.ForProvider.InfrastructureConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InfrastructureConfigurationArn") } mg.Spec.ForProvider.InfrastructureConfigurationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InfrastructureConfigurationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "DistributionConfiguration", + + "DistributionConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DistributionConfigurationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.DistributionConfigurationArnRef, - Selector: mg.Spec.InitProvider.DistributionConfigurationArnSelector, - To: reference.To{ - List: &DistributionConfigurationList{}, - Managed: &DistributionConfiguration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DistributionConfigurationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.DistributionConfigurationArnRef, + Selector: mg.Spec.InitProvider.DistributionConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DistributionConfigurationArn") } mg.Spec.InitProvider.DistributionConfigurationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DistributionConfigurationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "ImageRecipe", + + "ImageRecipeList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ImageRecipeArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ImageRecipeArnRef, - Selector: mg.Spec.InitProvider.ImageRecipeArnSelector, - To: reference.To{ - List: &ImageRecipeList{}, - Managed: &ImageRecipe{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ImageRecipeArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ImageRecipeArnRef, + Selector: mg.Spec.InitProvider.ImageRecipeArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ImageRecipeArn") } mg.Spec.InitProvider.ImageRecipeArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ImageRecipeArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "InfrastructureConfiguration", + + "InfrastructureConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InfrastructureConfigurationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.InfrastructureConfigurationArnRef, - Selector: mg.Spec.InitProvider.InfrastructureConfigurationArnSelector, - To: reference.To{ - List: &InfrastructureConfigurationList{}, - Managed: &InfrastructureConfiguration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InfrastructureConfigurationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.InfrastructureConfigurationArnRef, + Selector: mg.Spec.InitProvider.InfrastructureConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InfrastructureConfigurationArn") } @@ -284,69 +419,108 @@ func (mg *Image) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this ImagePipeline. func (mg *ImagePipeline) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "ImageRecipe", + + "ImageRecipeList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ImageRecipeArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ImageRecipeArnRef, - Selector: mg.Spec.ForProvider.ImageRecipeArnSelector, - To: reference.To{ - List: &ImageRecipeList{}, - Managed: &ImageRecipe{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ImageRecipeArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ImageRecipeArnRef, + Selector: mg.Spec.ForProvider.ImageRecipeArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ImageRecipeArn") } mg.Spec.ForProvider.ImageRecipeArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ImageRecipeArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "InfrastructureConfiguration", + + "InfrastructureConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InfrastructureConfigurationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.InfrastructureConfigurationArnRef, - Selector: mg.Spec.ForProvider.InfrastructureConfigurationArnSelector, - To: reference.To{ - List: &InfrastructureConfigurationList{}, - Managed: &InfrastructureConfiguration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InfrastructureConfigurationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.InfrastructureConfigurationArnRef, + Selector: mg.Spec.ForProvider.InfrastructureConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InfrastructureConfigurationArn") } mg.Spec.ForProvider.InfrastructureConfigurationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InfrastructureConfigurationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "ImageRecipe", + + "ImageRecipeList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ImageRecipeArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ImageRecipeArnRef, - Selector: mg.Spec.InitProvider.ImageRecipeArnSelector, - To: reference.To{ - List: &ImageRecipeList{}, - Managed: &ImageRecipe{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ImageRecipeArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ImageRecipeArnRef, + Selector: mg.Spec.InitProvider.ImageRecipeArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ImageRecipeArn") } mg.Spec.InitProvider.ImageRecipeArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ImageRecipeArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "InfrastructureConfiguration", + + "InfrastructureConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InfrastructureConfigurationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.InfrastructureConfigurationArnRef, - Selector: mg.Spec.InitProvider.InfrastructureConfigurationArnSelector, - To: reference.To{ - List: &InfrastructureConfigurationList{}, - Managed: &InfrastructureConfiguration{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InfrastructureConfigurationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.InfrastructureConfigurationArnRef, + Selector: mg.Spec.InitProvider.InfrastructureConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InfrastructureConfigurationArn") } @@ -358,22 +532,35 @@ func (mg *ImagePipeline) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this ImageRecipe. func (mg *ImageRecipe) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Component); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Component[i3].ComponentArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Component[i3].ComponentArnRef, - Selector: mg.Spec.ForProvider.Component[i3].ComponentArnSelector, - To: reference.To{ - List: &ComponentList{}, - Managed: &Component{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "Component", + + "ComponentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Component[i3].ComponentArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Component[i3].ComponentArnRef, + Selector: mg.Spec.ForProvider.Component[i3].ComponentArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Component[i3].ComponentArn") } @@ -382,16 +569,26 @@ func (mg *ImageRecipe) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.Component); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Component[i3].ComponentArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Component[i3].ComponentArnRef, - Selector: mg.Spec.InitProvider.Component[i3].ComponentArnSelector, - To: reference.To{ - List: &ComponentList{}, - Managed: &Component{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("imagebuilder.aws.upbound.io", + + "v1beta1", + + "Component", + + "ComponentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Component[i3].ComponentArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Component[i3].ComponentArnRef, + Selector: mg.Spec.InitProvider.Component[i3].ComponentArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Component[i3].ComponentArn") } @@ -405,38 +602,60 @@ func (mg *ImageRecipe) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this InfrastructureConfiguration. func (mg *InfrastructureConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceProfileName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.InstanceProfileNameRef, - Selector: mg.Spec.ForProvider.InstanceProfileNameSelector, - To: reference.To{ - List: &v1beta12.InstanceProfileList{}, - Managed: &v1beta12.InstanceProfile{}, - }, - }) + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceProfileName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.InstanceProfileNameRef, + Selector: mg.Spec.ForProvider.InstanceProfileNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceProfileName") } mg.Spec.ForProvider.InstanceProfileName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceProfileNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyPair), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KeyPairRef, - Selector: mg.Spec.ForProvider.KeyPairSelector, - To: reference.To{ - List: &v1beta13.KeyPairList{}, - Managed: &v1beta13.KeyPair{}, - }, - }) + "v1beta1", + + "KeyPair", + "KeyPairList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyPair), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KeyPairRef, + Selector: mg.Spec.ForProvider.KeyPairSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KeyPair") } @@ -445,16 +664,26 @@ func (mg *InfrastructureConfiguration) ResolveReferences(ctx context.Context, c for i3 := 0; i3 < len(mg.Spec.ForProvider.Logging); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Logging[i3].S3Logs); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Logging[i3].S3Logs[i4].S3BucketName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.Logging[i3].S3Logs[i4].S3BucketNameRef, - Selector: mg.Spec.ForProvider.Logging[i3].S3Logs[i4].S3BucketNameSelector, - To: reference.To{ - List: &v1beta14.BucketList{}, - Managed: &v1beta14.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Logging[i3].S3Logs[i4].S3BucketName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.Logging[i3].S3Logs[i4].S3BucketNameRef, + Selector: mg.Spec.ForProvider.Logging[i3].S3Logs[i4].S3BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Logging[i3].S3Logs[i4].S3BucketName") } @@ -463,80 +692,127 @@ func (mg *InfrastructureConfiguration) ResolveReferences(ctx context.Context, c } } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SnsTopicArnRef, - Selector: mg.Spec.ForProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta15.TopicList{}, - Managed: &v1beta15.Topic{}, - }, - }) + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SnsTopicArnRef, + Selector: mg.Spec.ForProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnsTopicArn") } mg.Spec.ForProvider.SnsTopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnsTopicArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceProfileName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.InstanceProfileNameRef, - Selector: mg.Spec.InitProvider.InstanceProfileNameSelector, - To: reference.To{ - List: &v1beta12.InstanceProfileList{}, - Managed: &v1beta12.InstanceProfile{}, - }, - }) + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceProfileName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.InstanceProfileNameRef, + Selector: mg.Spec.InitProvider.InstanceProfileNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceProfileName") } mg.Spec.InitProvider.InstanceProfileName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.InstanceProfileNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "KeyPair", + "KeyPairList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyPair), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KeyPairRef, - Selector: mg.Spec.InitProvider.KeyPairSelector, - To: reference.To{ - List: &v1beta13.KeyPairList{}, - Managed: &v1beta13.KeyPair{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyPair), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KeyPairRef, + Selector: mg.Spec.InitProvider.KeyPairSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KeyPair") } @@ -545,16 +821,26 @@ func (mg *InfrastructureConfiguration) ResolveReferences(ctx context.Context, c for i3 := 0; i3 < len(mg.Spec.InitProvider.Logging); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Logging[i3].S3Logs); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Logging[i3].S3Logs[i4].S3BucketName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.Logging[i3].S3Logs[i4].S3BucketNameRef, - Selector: mg.Spec.InitProvider.Logging[i3].S3Logs[i4].S3BucketNameSelector, - To: reference.To{ - List: &v1beta14.BucketList{}, - Managed: &v1beta14.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Logging[i3].S3Logs[i4].S3BucketName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.Logging[i3].S3Logs[i4].S3BucketNameRef, + Selector: mg.Spec.InitProvider.Logging[i3].S3Logs[i4].S3BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Logging[i3].S3Logs[i4].S3BucketName") } @@ -563,48 +849,76 @@ func (mg *InfrastructureConfiguration) ResolveReferences(ctx context.Context, c } } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SnsTopicArnRef, - Selector: mg.Spec.InitProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta15.TopicList{}, - Managed: &v1beta15.Topic{}, - }, - }) + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SnsTopicArnRef, + Selector: mg.Spec.InitProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnsTopicArn") } mg.Spec.InitProvider.SnsTopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SnsTopicArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } diff --git a/apis/inspector/v1beta1/zz_generated.resolvers.go b/apis/inspector/v1beta1/zz_generated.resolvers.go index f08d00af7c..2236d99956 100644 --- a/apis/inspector/v1beta1/zz_generated.resolvers.go +++ b/apis/inspector/v1beta1/zz_generated.resolvers.go @@ -10,43 +10,67 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AssessmentTarget. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this AssessmentTarget. func (mg *AssessmentTarget) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("inspector.aws.upbound.io", + + "v1beta1", + + "ResourceGroup", + + "ResourceGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceGroupArnRef, - Selector: mg.Spec.ForProvider.ResourceGroupArnSelector, - To: reference.To{ - List: &ResourceGroupList{}, - Managed: &ResourceGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceGroupArnRef, + Selector: mg.Spec.ForProvider.ResourceGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceGroupArn") } mg.Spec.ForProvider.ResourceGroupArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceGroupArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("inspector.aws.upbound.io", + + "v1beta1", + + "ResourceGroup", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceGroupArnRef, - Selector: mg.Spec.InitProvider.ResourceGroupArnSelector, - To: reference.To{ - List: &ResourceGroupList{}, - Managed: &ResourceGroup{}, - }, - }) + "ResourceGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceGroupArnRef, + Selector: mg.Spec.InitProvider.ResourceGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceGroupArn") } @@ -58,22 +82,35 @@ func (mg *AssessmentTarget) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this AssessmentTemplate. func (mg *AssessmentTemplate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.EventSubscription); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventSubscription[i3].TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.EventSubscription[i3].TopicArnRef, - Selector: mg.Spec.ForProvider.EventSubscription[i3].TopicArnSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventSubscription[i3].TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.EventSubscription[i3].TopicArnRef, + Selector: mg.Spec.ForProvider.EventSubscription[i3].TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventSubscription[i3].TopicArn") } @@ -81,16 +118,26 @@ func (mg *AssessmentTemplate) ResolveReferences(ctx context.Context, c client.Re mg.Spec.ForProvider.EventSubscription[i3].TopicArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TargetArnRef, - Selector: mg.Spec.ForProvider.TargetArnSelector, - To: reference.To{ - List: &AssessmentTargetList{}, - Managed: &AssessmentTarget{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("inspector.aws.upbound.io", + + "v1beta1", + + "AssessmentTarget", + + "AssessmentTargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TargetArnRef, + Selector: mg.Spec.ForProvider.TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetArn") } @@ -98,16 +145,26 @@ func (mg *AssessmentTemplate) ResolveReferences(ctx context.Context, c client.Re mg.Spec.ForProvider.TargetArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.EventSubscription); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventSubscription[i3].TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.EventSubscription[i3].TopicArnRef, - Selector: mg.Spec.InitProvider.EventSubscription[i3].TopicArnSelector, - To: reference.To{ - List: &v1beta1.TopicList{}, - Managed: &v1beta1.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventSubscription[i3].TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.EventSubscription[i3].TopicArnRef, + Selector: mg.Spec.InitProvider.EventSubscription[i3].TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventSubscription[i3].TopicArn") } @@ -115,16 +172,26 @@ func (mg *AssessmentTemplate) ResolveReferences(ctx context.Context, c client.Re mg.Spec.InitProvider.EventSubscription[i3].TopicArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TargetArnRef, - Selector: mg.Spec.InitProvider.TargetArnSelector, - To: reference.To{ - List: &AssessmentTargetList{}, - Managed: &AssessmentTarget{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("inspector.aws.upbound.io", + + "v1beta1", + + "AssessmentTarget", + + "AssessmentTargetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TargetArnRef, + Selector: mg.Spec.InitProvider.TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetArn") } diff --git a/apis/iot/v1beta1/zz_generated.resolvers.go b/apis/iot/v1beta1/zz_generated.resolvers.go index 8604a80bec..7c7aa9aa7b 100644 --- a/apis/iot/v1beta1/zz_generated.resolvers.go +++ b/apis/iot/v1beta1/zz_generated.resolvers.go @@ -10,46 +10,70 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/sns/v1beta1" + common "github.com/upbound/provider-aws/config/common" + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this LoggingOptions. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this LoggingOptions. func (mg *LoggingOptions) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -61,69 +85,108 @@ func (mg *LoggingOptions) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this PolicyAttachment. func (mg *PolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Policy), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PolicyRef, - Selector: mg.Spec.ForProvider.PolicySelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Policy), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PolicyRef, + Selector: mg.Spec.ForProvider.PolicySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Policy") } mg.Spec.ForProvider.Policy = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PolicyRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TargetRef, - Selector: mg.Spec.ForProvider.TargetSelector, - To: reference.To{ - List: &CertificateList{}, - Managed: &Certificate{}, - }, - }) + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TargetRef, + Selector: mg.Spec.ForProvider.TargetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Target") } mg.Spec.ForProvider.Target = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Policy), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PolicyRef, - Selector: mg.Spec.InitProvider.PolicySelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Policy), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PolicyRef, + Selector: mg.Spec.InitProvider.PolicySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Policy") } mg.Spec.InitProvider.Policy = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PolicyRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TargetRef, - Selector: mg.Spec.InitProvider.TargetSelector, - To: reference.To{ - List: &CertificateList{}, - Managed: &Certificate{}, - }, - }) + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TargetRef, + Selector: mg.Spec.InitProvider.TargetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Target") } @@ -135,37 +198,60 @@ func (mg *PolicyAttachment) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this ProvisioningTemplate. func (mg *ProvisioningTemplate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProvisioningRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ProvisioningRoleArnRef, - Selector: mg.Spec.ForProvider.ProvisioningRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProvisioningRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ProvisioningRoleArnRef, + Selector: mg.Spec.ForProvider.ProvisioningRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProvisioningRoleArn") } mg.Spec.ForProvider.ProvisioningRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProvisioningRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProvisioningRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ProvisioningRoleArnRef, - Selector: mg.Spec.InitProvider.ProvisioningRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProvisioningRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ProvisioningRoleArnRef, + Selector: mg.Spec.InitProvider.ProvisioningRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProvisioningRoleArn") } @@ -177,37 +263,60 @@ func (mg *ProvisioningTemplate) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this RoleAlias. func (mg *RoleAlias) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -219,37 +328,58 @@ func (mg *RoleAlias) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this ThingGroup. func (mg *ThingGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ParentGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ParentGroupNameRef, - Selector: mg.Spec.ForProvider.ParentGroupNameSelector, - To: reference.To{ - List: &ThingGroupList{}, - Managed: &ThingGroup{}, - }, - }) + "v1beta1", + + "ThingGroup", + "ThingGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ParentGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ParentGroupNameRef, + Selector: mg.Spec.ForProvider.ParentGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ParentGroupName") } mg.Spec.ForProvider.ParentGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ParentGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", + + "v1beta1", + + "ThingGroup", + "ThingGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ParentGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ParentGroupNameRef, - Selector: mg.Spec.InitProvider.ParentGroupNameSelector, - To: reference.To{ - List: &ThingGroupList{}, - Managed: &ThingGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ParentGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ParentGroupNameRef, + Selector: mg.Spec.InitProvider.ParentGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ParentGroupName") } @@ -261,69 +391,108 @@ func (mg *ThingGroup) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this ThingPrincipalAttachment. func (mg *ThingPrincipalAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Principal), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.PrincipalRef, - Selector: mg.Spec.ForProvider.PrincipalSelector, - To: reference.To{ - List: &CertificateList{}, - Managed: &Certificate{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Principal), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.PrincipalRef, + Selector: mg.Spec.ForProvider.PrincipalSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Principal") } mg.Spec.ForProvider.Principal = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrincipalRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Thing), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ThingRef, - Selector: mg.Spec.ForProvider.ThingSelector, - To: reference.To{ - List: &ThingList{}, - Managed: &Thing{}, - }, - }) + "Thing", + "ThingList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Thing), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ThingRef, + Selector: mg.Spec.ForProvider.ThingSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Thing") } mg.Spec.ForProvider.Thing = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ThingRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", + + "v1beta1", + + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Principal), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.PrincipalRef, - Selector: mg.Spec.InitProvider.PrincipalSelector, - To: reference.To{ - List: &CertificateList{}, - Managed: &Certificate{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Principal), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.PrincipalRef, + Selector: mg.Spec.InitProvider.PrincipalSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Principal") } mg.Spec.InitProvider.Principal = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PrincipalRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iot.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Thing), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ThingRef, - Selector: mg.Spec.InitProvider.ThingSelector, - To: reference.To{ - List: &ThingList{}, - Managed: &Thing{}, - }, - }) + "Thing", + "ThingList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Thing), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ThingRef, + Selector: mg.Spec.InitProvider.ThingSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Thing") } @@ -335,6 +504,9 @@ func (mg *ThingPrincipalAttachment) ResolveReferences(ctx context.Context, c cli // ResolveReferences of this TopicRule. func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -342,16 +514,27 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err for i3 := 0; i3 < len(mg.Spec.ForProvider.ErrorAction); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ErrorAction[i3].Sns); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].RoleArn") } @@ -362,16 +545,26 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.ErrorAction); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.ErrorAction[i3].Sns); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].TargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].TargetArnRef, - Selector: mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].TargetArnSelector, - To: reference.To{ - List: &v1beta11.TopicList{}, - Managed: &v1beta11.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].TargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].TargetArnRef, + Selector: mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ErrorAction[i3].Sns[i4].TargetArn") } @@ -381,16 +574,27 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err } } for i3 := 0; i3 < len(mg.Spec.ForProvider.Sns); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Sns[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Sns[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.Sns[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Sns[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Sns[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.Sns[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Sns[i3].RoleArn") } @@ -399,16 +603,26 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.Sns); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Sns[i3].TargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Sns[i3].TargetArnRef, - Selector: mg.Spec.ForProvider.Sns[i3].TargetArnSelector, - To: reference.To{ - List: &v1beta11.TopicList{}, - Managed: &v1beta11.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Sns[i3].TargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Sns[i3].TargetArnRef, + Selector: mg.Spec.ForProvider.Sns[i3].TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Sns[i3].TargetArn") } @@ -418,16 +632,27 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.ErrorAction); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ErrorAction[i3].Sns); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].RoleArn") } @@ -438,16 +663,26 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.ErrorAction); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.ErrorAction[i3].Sns); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].TargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].TargetArnRef, - Selector: mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].TargetArnSelector, - To: reference.To{ - List: &v1beta11.TopicList{}, - Managed: &v1beta11.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].TargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].TargetArnRef, + Selector: mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ErrorAction[i3].Sns[i4].TargetArn") } @@ -457,16 +692,27 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err } } for i3 := 0; i3 < len(mg.Spec.InitProvider.Sns); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Sns[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Sns[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.Sns[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Sns[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Sns[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.Sns[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Sns[i3].RoleArn") } @@ -475,16 +721,26 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.Sns); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Sns[i3].TargetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Sns[i3].TargetArnRef, - Selector: mg.Spec.InitProvider.Sns[i3].TargetArnSelector, - To: reference.To{ - List: &v1beta11.TopicList{}, - Managed: &v1beta11.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Sns[i3].TargetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Sns[i3].TargetArnRef, + Selector: mg.Spec.InitProvider.Sns[i3].TargetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Sns[i3].TargetArn") } @@ -498,6 +754,9 @@ func (mg *TopicRule) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this TopicRuleDestination. func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -505,16 +764,27 @@ func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client. var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.VPCConfiguration[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.VPCConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.VPCConfiguration[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.VPCConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfiguration[i3].RoleArn") } @@ -523,16 +793,26 @@ func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client. } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfiguration); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfiguration[i3].SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfiguration[i3].SecurityGroupRefs, - Selector: mg.Spec.ForProvider.VPCConfiguration[i3].SecurityGroupSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfiguration[i3].SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfiguration[i3].SecurityGroupRefs, + Selector: mg.Spec.ForProvider.VPCConfiguration[i3].SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfiguration[i3].SecurityGroups") } @@ -541,16 +821,26 @@ func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client. } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfiguration); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfiguration[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfiguration[i3].SubnetIDRefs, - Selector: mg.Spec.ForProvider.VPCConfiguration[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfiguration[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfiguration[i3].SubnetIDRefs, + Selector: mg.Spec.ForProvider.VPCConfiguration[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfiguration[i3].SubnetIds") } @@ -559,16 +849,25 @@ func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client. } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCConfiguration[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDRef, - Selector: mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta12.VPCList{}, - Managed: &v1beta12.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCConfiguration[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDRef, + Selector: mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfiguration[i3].VPCID") } @@ -577,16 +876,27 @@ func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client. } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCConfiguration[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.VPCConfiguration[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.VPCConfiguration[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCConfiguration[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.VPCConfiguration[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.VPCConfiguration[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfiguration[i3].RoleArn") } @@ -595,16 +905,26 @@ func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client. } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfiguration); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfiguration[i3].SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfiguration[i3].SecurityGroupRefs, - Selector: mg.Spec.InitProvider.VPCConfiguration[i3].SecurityGroupSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfiguration[i3].SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfiguration[i3].SecurityGroupRefs, + Selector: mg.Spec.InitProvider.VPCConfiguration[i3].SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfiguration[i3].SecurityGroups") } @@ -613,16 +933,26 @@ func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client. } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfiguration); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfiguration[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfiguration[i3].SubnetIDRefs, - Selector: mg.Spec.InitProvider.VPCConfiguration[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfiguration[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfiguration[i3].SubnetIDRefs, + Selector: mg.Spec.InitProvider.VPCConfiguration[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfiguration[i3].SubnetIds") } @@ -631,16 +961,25 @@ func (mg *TopicRuleDestination) ResolveReferences(ctx context.Context, c client. } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCConfiguration[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCConfiguration[i3].VPCIDRef, - Selector: mg.Spec.InitProvider.VPCConfiguration[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta12.VPCList{}, - Managed: &v1beta12.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCConfiguration[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCConfiguration[i3].VPCIDRef, + Selector: mg.Spec.InitProvider.VPCConfiguration[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfiguration[i3].VPCID") } diff --git a/apis/kafka/v1beta1/zz_generated.resolvers.go b/apis/kafka/v1beta1/zz_generated.resolvers.go index 38ffef7586..10e5d91d36 100644 --- a/apis/kafka/v1beta1/zz_generated.resolvers.go +++ b/apis/kafka/v1beta1/zz_generated.resolvers.go @@ -10,18 +10,19 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/firehose/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/s3/v1beta1" - v1beta15 "github.com/upbound/provider-aws/apis/secretsmanager/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Cluster. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -29,16 +30,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.BrokerNodeGroupInfo); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].ClientSubnets), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].ClientSubnetsRefs, - Selector: mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].ClientSubnetsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].ClientSubnets), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].ClientSubnetsRefs, + Selector: mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].ClientSubnetsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].ClientSubnets") } @@ -47,16 +58,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.BrokerNodeGroupInfo); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroupsRefs, - Selector: mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroupsSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroupsRefs, + Selector: mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroupsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroups") } @@ -65,16 +86,27 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.ConfigurationInfo); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationInfo[i3].Arn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ConfigurationInfo[i3].ArnRef, - Selector: mg.Spec.ForProvider.ConfigurationInfo[i3].ArnSelector, - To: reference.To{ - List: &ConfigurationList{}, - Managed: &Configuration{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kafka.aws.upbound.io", + + "v1beta1", + + "Configuration", + + "ConfigurationList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationInfo[i3].Arn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ConfigurationInfo[i3].ArnRef, + Selector: mg.Spec.ForProvider.ConfigurationInfo[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationInfo[i3].Arn") } @@ -83,16 +115,25 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.EncryptionInfo); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArnRef, - Selector: mg.Spec.ForProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArnRef, + Selector: mg.Spec.ForProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArn") } @@ -103,16 +144,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.ForProvider.LoggingInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroup), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroupRef, - Selector: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroupSelector, - To: reference.To{ - List: &v1beta12.GroupList{}, - Managed: &v1beta12.Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroup), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroupRef, + Selector: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroup") } @@ -125,16 +176,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.ForProvider.LoggingInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStream), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStreamRef, - Selector: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStreamSelector, - To: reference.To{ - List: &v1beta13.DeliveryStreamList{}, - Managed: &v1beta13.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStream), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStreamRef, + Selector: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStreamSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStream") } @@ -147,16 +208,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.ForProvider.LoggingInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].S3); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].BucketRef, - Selector: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].BucketSelector, - To: reference.To{ - List: &v1beta14.BucketList{}, - Managed: &v1beta14.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].BucketRef, + Selector: mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].Bucket") } @@ -167,16 +238,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } } for i3 := 0; i3 < len(mg.Spec.InitProvider.BrokerNodeGroupInfo); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].ClientSubnets), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].ClientSubnetsRefs, - Selector: mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].ClientSubnetsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].ClientSubnets), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].ClientSubnetsRefs, + Selector: mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].ClientSubnetsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].ClientSubnets") } @@ -185,16 +266,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.BrokerNodeGroupInfo); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].SecurityGroupsRefs, - Selector: mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].SecurityGroupsSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].SecurityGroupsRefs, + Selector: mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].SecurityGroupsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BrokerNodeGroupInfo[i3].SecurityGroups") } @@ -203,16 +294,27 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.ConfigurationInfo); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationInfo[i3].Arn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ConfigurationInfo[i3].ArnRef, - Selector: mg.Spec.InitProvider.ConfigurationInfo[i3].ArnSelector, - To: reference.To{ - List: &ConfigurationList{}, - Managed: &Configuration{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kafka.aws.upbound.io", + + "v1beta1", + + "Configuration", + + "ConfigurationList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationInfo[i3].Arn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ConfigurationInfo[i3].ArnRef, + Selector: mg.Spec.InitProvider.ConfigurationInfo[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConfigurationInfo[i3].Arn") } @@ -221,16 +323,25 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.EncryptionInfo); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArnRef, - Selector: mg.Spec.InitProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArnRef, + Selector: mg.Spec.InitProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EncryptionInfo[i3].EncryptionAtRestKMSKeyArn") } @@ -241,16 +352,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.InitProvider.LoggingInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroup), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroupRef, - Selector: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroupSelector, - To: reference.To{ - List: &v1beta12.GroupList{}, - Managed: &v1beta12.Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroup), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroupRef, + Selector: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].CloudwatchLogs[i5].LogGroup") } @@ -263,16 +384,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.InitProvider.LoggingInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStream), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStreamRef, - Selector: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStreamSelector, - To: reference.To{ - List: &v1beta13.DeliveryStreamList{}, - Managed: &v1beta13.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStream), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStreamRef, + Selector: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStreamSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].Firehose[i5].DeliveryStream") } @@ -285,16 +416,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.InitProvider.LoggingInfo); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].S3); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].BucketRef, - Selector: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].BucketSelector, - To: reference.To{ - List: &v1beta14.BucketList{}, - Managed: &v1beta14.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].BucketRef, + Selector: mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoggingInfo[i3].BrokerLogs[i4].S3[i5].Bucket") } @@ -310,70 +451,107 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ScramSecretAssociation. func (mg *ScramSecretAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kafka.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ClusterArnRef, - Selector: mg.Spec.ForProvider.ClusterArnSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ClusterArnRef, + Selector: mg.Spec.ForProvider.ClusterArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterArn") } mg.Spec.ForProvider.ClusterArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecretArnList), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecretArnRefs, - Selector: mg.Spec.ForProvider.SecretArnSelector, - To: reference.To{ - List: &v1beta15.SecretList{}, - Managed: &v1beta15.Secret{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecretArnList), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecretArnRefs, + Selector: mg.Spec.ForProvider.SecretArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecretArnList") } mg.Spec.ForProvider.SecretArnList = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecretArnRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("kafka.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ClusterArnRef, - Selector: mg.Spec.InitProvider.ClusterArnSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ClusterArnRef, + Selector: mg.Spec.InitProvider.ClusterArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterArn") } mg.Spec.InitProvider.ClusterArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecretArnList), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecretArnRefs, - Selector: mg.Spec.InitProvider.SecretArnSelector, - To: reference.To{ - List: &v1beta15.SecretList{}, - Managed: &v1beta15.Secret{}, - }, - }) + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecretArnList), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecretArnRefs, + Selector: mg.Spec.InitProvider.SecretArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecretArnList") } @@ -385,22 +563,35 @@ func (mg *ScramSecretAssociation) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this ServerlessCluster. func (mg *ServerlessCluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds") } @@ -409,16 +600,26 @@ func (mg *ServerlessCluster) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SubnetIds") } @@ -427,16 +628,26 @@ func (mg *ServerlessCluster) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds") } @@ -445,16 +656,26 @@ func (mg *ServerlessCluster) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SubnetIds") } diff --git a/apis/kendra/v1beta1/zz_generated.resolvers.go b/apis/kendra/v1beta1/zz_generated.resolvers.go index 48b7dee8eb..0fc211243c 100644 --- a/apis/kendra/v1beta1/zz_generated.resolvers.go +++ b/apis/kendra/v1beta1/zz_generated.resolvers.go @@ -10,15 +10,19 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/secretsmanager/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this DataSource. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this DataSource. func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -26,16 +30,26 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er for i3 := 0; i3 < len(mg.Spec.ForProvider.Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Configuration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].S3Configuration[i4].BucketName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Configuration[i3].S3Configuration[i4].BucketNameRef, - Selector: mg.Spec.ForProvider.Configuration[i3].S3Configuration[i4].BucketNameSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].S3Configuration[i4].BucketName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Configuration[i3].S3Configuration[i4].BucketNameRef, + Selector: mg.Spec.ForProvider.Configuration[i3].S3Configuration[i4].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Configuration[i3].S3Configuration[i4].BucketName") } @@ -48,16 +62,25 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er for i4 := 0; i4 < len(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].Credentials), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].CredentialsRef, - Selector: mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].CredentialsSelector, - To: reference.To{ - List: &v1beta11.SecretList{}, - Managed: &v1beta11.Secret{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].Credentials), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].CredentialsRef, + Selector: mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].CredentialsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].Credentials") } @@ -71,16 +94,25 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er for i3 := 0; i3 < len(mg.Spec.ForProvider.Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].Credentials), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].CredentialsRef, - Selector: mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].CredentialsSelector, - To: reference.To{ - List: &v1beta11.SecretList{}, - Managed: &v1beta11.Secret{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].Credentials), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].CredentialsRef, + Selector: mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].CredentialsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].Credentials") } @@ -90,32 +122,52 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IndexID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IndexIDRef, - Selector: mg.Spec.ForProvider.IndexIDSelector, - To: reference.To{ - List: &IndexList{}, - Managed: &Index{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kendra.aws.upbound.io", + + "v1beta1", + + "Index", + "IndexList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IndexID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IndexIDRef, + Selector: mg.Spec.ForProvider.IndexIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IndexID") } mg.Spec.ForProvider.IndexID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IndexIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } @@ -124,16 +176,26 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er for i3 := 0; i3 < len(mg.Spec.InitProvider.Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Configuration[i3].S3Configuration); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].S3Configuration[i4].BucketName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Configuration[i3].S3Configuration[i4].BucketNameRef, - Selector: mg.Spec.InitProvider.Configuration[i3].S3Configuration[i4].BucketNameSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].S3Configuration[i4].BucketName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Configuration[i3].S3Configuration[i4].BucketNameRef, + Selector: mg.Spec.InitProvider.Configuration[i3].S3Configuration[i4].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Configuration[i3].S3Configuration[i4].BucketName") } @@ -146,16 +208,25 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er for i4 := 0; i4 < len(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].Credentials), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].CredentialsRef, - Selector: mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].CredentialsSelector, - To: reference.To{ - List: &v1beta11.SecretList{}, - Managed: &v1beta11.Secret{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].Credentials), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].CredentialsRef, + Selector: mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].CredentialsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].AuthenticationConfiguration[i5].BasicAuthentication[i6].Credentials") } @@ -169,16 +240,25 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er for i3 := 0; i3 < len(mg.Spec.InitProvider.Configuration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].Credentials), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].CredentialsRef, - Selector: mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].CredentialsSelector, - To: reference.To{ - List: &v1beta11.SecretList{}, - Managed: &v1beta11.Secret{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].Credentials), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].CredentialsRef, + Selector: mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].CredentialsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Configuration[i3].WebCrawlerConfiguration[i4].ProxyConfiguration[i5].Credentials") } @@ -188,32 +268,52 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IndexID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IndexIDRef, - Selector: mg.Spec.InitProvider.IndexIDSelector, - To: reference.To{ - List: &IndexList{}, - Managed: &Index{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kendra.aws.upbound.io", + + "v1beta1", + + "Index", + "IndexList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IndexID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IndexIDRef, + Selector: mg.Spec.InitProvider.IndexIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IndexID") } mg.Spec.InitProvider.IndexID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IndexIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -225,69 +325,110 @@ func (mg *DataSource) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Experience. func (mg *Experience) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kendra.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IndexID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IndexIDRef, - Selector: mg.Spec.ForProvider.IndexIDSelector, - To: reference.To{ - List: &IndexList{}, - Managed: &Index{}, - }, - }) + "v1beta1", + + "Index", + "IndexList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IndexID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IndexIDRef, + Selector: mg.Spec.ForProvider.IndexIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IndexID") } mg.Spec.ForProvider.IndexID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IndexIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kendra.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IndexID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IndexIDRef, - Selector: mg.Spec.InitProvider.IndexIDSelector, - To: reference.To{ - List: &IndexList{}, - Managed: &Index{}, - }, - }) + "Index", + "IndexList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IndexID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IndexIDRef, + Selector: mg.Spec.InitProvider.IndexIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IndexID") } mg.Spec.InitProvider.IndexID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IndexIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -299,37 +440,60 @@ func (mg *Experience) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Index. func (mg *Index) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -341,37 +505,59 @@ func (mg *Index) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this QuerySuggestionsBlockList. func (mg *QuerySuggestionsBlockList) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kendra.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IndexID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IndexIDRef, - Selector: mg.Spec.ForProvider.IndexIDSelector, - To: reference.To{ - List: &IndexList{}, - Managed: &Index{}, - }, - }) + "Index", + "IndexList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IndexID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IndexIDRef, + Selector: mg.Spec.ForProvider.IndexIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IndexID") } mg.Spec.ForProvider.IndexID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IndexIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } @@ -379,16 +565,26 @@ func (mg *QuerySuggestionsBlockList) ResolveReferences(ctx context.Context, c cl mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.SourceS3Path); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceS3Path[i3].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SourceS3Path[i3].BucketRef, - Selector: mg.Spec.ForProvider.SourceS3Path[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceS3Path[i3].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SourceS3Path[i3].BucketRef, + Selector: mg.Spec.ForProvider.SourceS3Path[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceS3Path[i3].Bucket") } @@ -396,32 +592,52 @@ func (mg *QuerySuggestionsBlockList) ResolveReferences(ctx context.Context, c cl mg.Spec.ForProvider.SourceS3Path[i3].BucketRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IndexID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IndexIDRef, - Selector: mg.Spec.InitProvider.IndexIDSelector, - To: reference.To{ - List: &IndexList{}, - Managed: &Index{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kendra.aws.upbound.io", + + "v1beta1", + + "Index", + "IndexList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IndexID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IndexIDRef, + Selector: mg.Spec.InitProvider.IndexIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IndexID") } mg.Spec.InitProvider.IndexID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IndexIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -429,16 +645,26 @@ func (mg *QuerySuggestionsBlockList) ResolveReferences(ctx context.Context, c cl mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.SourceS3Path); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceS3Path[i3].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SourceS3Path[i3].BucketRef, - Selector: mg.Spec.InitProvider.SourceS3Path[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceS3Path[i3].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SourceS3Path[i3].BucketRef, + Selector: mg.Spec.InitProvider.SourceS3Path[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceS3Path[i3].Bucket") } @@ -452,37 +678,59 @@ func (mg *QuerySuggestionsBlockList) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this Thesaurus. func (mg *Thesaurus) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kendra.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IndexID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IndexIDRef, - Selector: mg.Spec.ForProvider.IndexIDSelector, - To: reference.To{ - List: &IndexList{}, - Managed: &Index{}, - }, - }) + "Index", + "IndexList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IndexID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IndexIDRef, + Selector: mg.Spec.ForProvider.IndexIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IndexID") } mg.Spec.ForProvider.IndexID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IndexIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } @@ -490,16 +738,26 @@ func (mg *Thesaurus) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.SourceS3Path); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceS3Path[i3].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SourceS3Path[i3].BucketRef, - Selector: mg.Spec.ForProvider.SourceS3Path[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceS3Path[i3].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SourceS3Path[i3].BucketRef, + Selector: mg.Spec.ForProvider.SourceS3Path[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceS3Path[i3].Bucket") } @@ -508,16 +766,26 @@ func (mg *Thesaurus) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.SourceS3Path); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceS3Path[i3].Key), - Extract: resource.ExtractParamPath("key", false), - Reference: mg.Spec.ForProvider.SourceS3Path[i3].KeyRef, - Selector: mg.Spec.ForProvider.SourceS3Path[i3].KeySelector, - To: reference.To{ - List: &v1beta1.ObjectList{}, - Managed: &v1beta1.Object{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceS3Path[i3].Key), + Extract: resource.ExtractParamPath("key", false), + Reference: mg.Spec.ForProvider.SourceS3Path[i3].KeyRef, + Selector: mg.Spec.ForProvider.SourceS3Path[i3].KeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceS3Path[i3].Key") } @@ -525,32 +793,52 @@ func (mg *Thesaurus) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.ForProvider.SourceS3Path[i3].KeyRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IndexID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IndexIDRef, - Selector: mg.Spec.InitProvider.IndexIDSelector, - To: reference.To{ - List: &IndexList{}, - Managed: &Index{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kendra.aws.upbound.io", + + "v1beta1", + + "Index", + "IndexList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IndexID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IndexIDRef, + Selector: mg.Spec.InitProvider.IndexIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IndexID") } mg.Spec.InitProvider.IndexID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IndexIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -558,16 +846,26 @@ func (mg *Thesaurus) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.SourceS3Path); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceS3Path[i3].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SourceS3Path[i3].BucketRef, - Selector: mg.Spec.InitProvider.SourceS3Path[i3].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceS3Path[i3].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SourceS3Path[i3].BucketRef, + Selector: mg.Spec.InitProvider.SourceS3Path[i3].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceS3Path[i3].Bucket") } @@ -576,16 +874,26 @@ func (mg *Thesaurus) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.SourceS3Path); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceS3Path[i3].Key), - Extract: resource.ExtractParamPath("key", false), - Reference: mg.Spec.InitProvider.SourceS3Path[i3].KeyRef, - Selector: mg.Spec.InitProvider.SourceS3Path[i3].KeySelector, - To: reference.To{ - List: &v1beta1.ObjectList{}, - Managed: &v1beta1.Object{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceS3Path[i3].Key), + Extract: resource.ExtractParamPath("key", false), + Reference: mg.Spec.InitProvider.SourceS3Path[i3].KeyRef, + Selector: mg.Spec.InitProvider.SourceS3Path[i3].KeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceS3Path[i3].Key") } diff --git a/apis/keyspaces/v1beta1/zz_generated.resolvers.go b/apis/keyspaces/v1beta1/zz_generated.resolvers.go index bddc8c58d4..bdb70a2eb4 100644 --- a/apis/keyspaces/v1beta1/zz_generated.resolvers.go +++ b/apis/keyspaces/v1beta1/zz_generated.resolvers.go @@ -8,43 +8,69 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Table. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Table. func (mg *Table) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("keyspaces.aws.upbound.io", + + "v1beta1", + + "Keyspace", + + "KeyspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyspaceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KeyspaceNameRef, - Selector: mg.Spec.ForProvider.KeyspaceNameSelector, - To: reference.To{ - List: &KeyspaceList{}, - Managed: &Keyspace{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyspaceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KeyspaceNameRef, + Selector: mg.Spec.ForProvider.KeyspaceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KeyspaceName") } mg.Spec.ForProvider.KeyspaceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KeyspaceNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("keyspaces.aws.upbound.io", + + "v1beta1", + + "Keyspace", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyspaceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KeyspaceNameRef, - Selector: mg.Spec.InitProvider.KeyspaceNameSelector, - To: reference.To{ - List: &KeyspaceList{}, - Managed: &Keyspace{}, - }, - }) + "KeyspaceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyspaceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KeyspaceNameRef, + Selector: mg.Spec.InitProvider.KeyspaceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KeyspaceName") } diff --git a/apis/kinesis/v1beta1/zz_generated.resolvers.go b/apis/kinesis/v1beta1/zz_generated.resolvers.go index 8d3b8566fa..dcbc6e3804 100644 --- a/apis/kinesis/v1beta1/zz_generated.resolvers.go +++ b/apis/kinesis/v1beta1/zz_generated.resolvers.go @@ -9,44 +9,66 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Stream. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Stream. func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -58,37 +80,58 @@ func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this StreamConsumer. func (mg *StreamConsumer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StreamArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.StreamArnRef, - Selector: mg.Spec.ForProvider.StreamArnSelector, - To: reference.To{ - List: &StreamList{}, - Managed: &Stream{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StreamArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.StreamArnRef, + Selector: mg.Spec.ForProvider.StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StreamArn") } mg.Spec.ForProvider.StreamArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StreamArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StreamArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.StreamArnRef, - Selector: mg.Spec.InitProvider.StreamArnSelector, - To: reference.To{ - List: &StreamList{}, - Managed: &Stream{}, - }, - }) + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StreamArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.StreamArnRef, + Selector: mg.Spec.InitProvider.StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StreamArn") } diff --git a/apis/kinesisanalytics/v1beta1/zz_generated.resolvers.go b/apis/kinesisanalytics/v1beta1/zz_generated.resolvers.go index c1cf6798e7..5459e3d747 100644 --- a/apis/kinesisanalytics/v1beta1/zz_generated.resolvers.go +++ b/apis/kinesisanalytics/v1beta1/zz_generated.resolvers.go @@ -10,32 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/firehose/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Application. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Application. func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.CloudwatchLoggingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef, - Selector: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnSelector, - To: reference.To{ - List: &v1beta1.StreamList{}, - Managed: &v1beta1.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Stream", + + "StreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef, + Selector: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArn") } @@ -44,16 +56,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.ForProvider.CloudwatchLoggingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].RoleArn") } @@ -63,16 +86,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.ForProvider.Inputs); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Inputs[i3].KinesisStream); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].ResourceArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].ResourceArnRef, - Selector: mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].ResourceArnSelector, - To: reference.To{ - List: &v1beta12.StreamList{}, - Managed: &v1beta12.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].ResourceArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].ResourceArnRef, + Selector: mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].ResourceArn") } @@ -83,16 +116,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.ForProvider.Inputs); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Inputs[i3].KinesisStream); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Inputs[i3].KinesisStream[i4].RoleArn") } @@ -103,16 +147,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.ForProvider.Outputs); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Outputs[i3].KinesisFirehose); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].ResourceArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].ResourceArnRef, - Selector: mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].ResourceArnSelector, - To: reference.To{ - List: &v1beta13.DeliveryStreamList{}, - Managed: &v1beta13.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].ResourceArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].ResourceArnRef, + Selector: mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].ResourceArn") } @@ -123,16 +177,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.ForProvider.Outputs); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Outputs[i3].KinesisFirehose); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].RoleArnRef, - Selector: mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].RoleArnRef, + Selector: mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Outputs[i3].KinesisFirehose[i4].RoleArn") } @@ -142,16 +207,25 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } } for i3 := 0; i3 < len(mg.Spec.InitProvider.CloudwatchLoggingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef, - Selector: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnSelector, - To: reference.To{ - List: &v1beta1.StreamList{}, - Managed: &v1beta1.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Stream", + + "StreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef, + Selector: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArn") } @@ -160,16 +234,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.CloudwatchLoggingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].RoleArn") } @@ -179,16 +264,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.Inputs); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Inputs[i3].KinesisStream); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].ResourceArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].ResourceArnRef, - Selector: mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].ResourceArnSelector, - To: reference.To{ - List: &v1beta12.StreamList{}, - Managed: &v1beta12.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].ResourceArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].ResourceArnRef, + Selector: mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].ResourceArn") } @@ -199,16 +294,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.Inputs); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Inputs[i3].KinesisStream); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Inputs[i3].KinesisStream[i4].RoleArn") } @@ -219,16 +325,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.Outputs); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Outputs[i3].KinesisFirehose); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].ResourceArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].ResourceArnRef, - Selector: mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].ResourceArnSelector, - To: reference.To{ - List: &v1beta13.DeliveryStreamList{}, - Managed: &v1beta13.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].ResourceArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].ResourceArnRef, + Selector: mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].ResourceArn") } @@ -239,16 +355,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.Outputs); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Outputs[i3].KinesisFirehose); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].RoleArnRef, - Selector: mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].RoleArnRef, + Selector: mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Outputs[i3].KinesisFirehose[i4].RoleArn") } diff --git a/apis/kinesisanalyticsv2/v1beta1/zz_generated.resolvers.go b/apis/kinesisanalyticsv2/v1beta1/zz_generated.resolvers.go index 825fcbdc33..d1e40cf3ca 100644 --- a/apis/kinesisanalyticsv2/v1beta1/zz_generated.resolvers.go +++ b/apis/kinesisanalyticsv2/v1beta1/zz_generated.resolvers.go @@ -10,18 +10,19 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta14 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/firehose/v1beta1" - v1beta15 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/lambda/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Application. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Application. func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -31,16 +32,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArnRef, - Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArnSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArnRef, + Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArn") } @@ -55,16 +66,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKey), - Extract: resource.ExtractParamPath("key", false), - Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKeyRef, - Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKeySelector, - To: reference.To{ - List: &v1beta1.ObjectList{}, - Managed: &v1beta1.Object{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKey), + Extract: resource.ExtractParamPath("key", false), + Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKeyRef, + Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKey") } @@ -79,16 +100,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArnRef, - Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArnSelector, - To: reference.To{ - List: &v1beta11.StreamList{}, - Managed: &v1beta11.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArnRef, + Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArn") } @@ -103,16 +134,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArnRef, - Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArnSelector, - To: reference.To{ - List: &v1beta12.DeliveryStreamList{}, - Managed: &v1beta12.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArnRef, + Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArn") } @@ -127,16 +168,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArnRef, - Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArnSelector, - To: reference.To{ - List: &v1beta13.FunctionList{}, - Managed: &v1beta13.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArnRef, + Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArn") } @@ -151,16 +202,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArnRef, - Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArnSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArnRef, + Selector: mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArn") } @@ -172,16 +233,25 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } } for i3 := 0; i3 < len(mg.Spec.ForProvider.CloudwatchLoggingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef, - Selector: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnSelector, - To: reference.To{ - List: &v1beta14.StreamList{}, - Managed: &v1beta14.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Stream", + + "StreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef, + Selector: mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArn") } @@ -189,16 +259,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e mg.Spec.ForProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceExecutionRole), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceExecutionRoleRef, - Selector: mg.Spec.ForProvider.ServiceExecutionRoleSelector, - To: reference.To{ - List: &v1beta15.RoleList{}, - Managed: &v1beta15.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceExecutionRole), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceExecutionRoleRef, + Selector: mg.Spec.ForProvider.ServiceExecutionRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceExecutionRole") } @@ -209,16 +290,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArnRef, - Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArnSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArnRef, + Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].BucketArn") } @@ -233,16 +324,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKey), - Extract: resource.ExtractParamPath("key", false), - Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKeyRef, - Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKeySelector, - To: reference.To{ - List: &v1beta1.ObjectList{}, - Managed: &v1beta1.Object{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Object", + "ObjectList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKey), + Extract: resource.ExtractParamPath("key", false), + Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKeyRef, + Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationConfiguration[i3].ApplicationCodeConfiguration[i4].CodeContent[i5].S3ContentLocation[i6].FileKey") } @@ -257,16 +358,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArnRef, - Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArnSelector, - To: reference.To{ - List: &v1beta11.StreamList{}, - Managed: &v1beta11.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArnRef, + Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Input[i5].KinesisStreamsInput[i6].ResourceArn") } @@ -281,16 +392,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArnRef, - Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArnSelector, - To: reference.To{ - List: &v1beta12.DeliveryStreamList{}, - Managed: &v1beta12.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArnRef, + Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].KinesisFirehoseOutput[i6].ResourceArn") } @@ -305,16 +426,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArnRef, - Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArnSelector, - To: reference.To{ - List: &v1beta13.FunctionList{}, - Managed: &v1beta13.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArnRef, + Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].Output[i5].LambdaOutput[i6].ResourceArn") } @@ -329,16 +460,26 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e for i4 := 0; i4 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArnRef, - Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArnSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArnRef, + Selector: mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationConfiguration[i3].SQLApplicationConfiguration[i4].ReferenceDataSource[i5].S3ReferenceDataSource[i6].BucketArn") } @@ -350,16 +491,25 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e } } for i3 := 0; i3 < len(mg.Spec.InitProvider.CloudwatchLoggingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef, - Selector: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnSelector, - To: reference.To{ - List: &v1beta14.StreamList{}, - Managed: &v1beta14.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Stream", + + "StreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef, + Selector: mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArn") } @@ -367,16 +517,27 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e mg.Spec.InitProvider.CloudwatchLoggingOptions[i3].LogStreamArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceExecutionRole), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceExecutionRoleRef, - Selector: mg.Spec.InitProvider.ServiceExecutionRoleSelector, - To: reference.To{ - List: &v1beta15.RoleList{}, - Managed: &v1beta15.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceExecutionRole), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceExecutionRoleRef, + Selector: mg.Spec.InitProvider.ServiceExecutionRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceExecutionRole") } @@ -388,37 +549,56 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this ApplicationSnapshot. func (mg *ApplicationSnapshot) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kinesisanalyticsv2.aws.upbound.io", + + "v1beta1", + "Application", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ApplicationNameRef, - Selector: mg.Spec.ForProvider.ApplicationNameSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ApplicationNameRef, + Selector: mg.Spec.ForProvider.ApplicationNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationName") } mg.Spec.ForProvider.ApplicationName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApplicationNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kinesisanalyticsv2.aws.upbound.io", + + "v1beta1", + "Application", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ApplicationNameRef, - Selector: mg.Spec.InitProvider.ApplicationNameSelector, - To: reference.To{ - List: &ApplicationList{}, - Managed: &Application{}, - }, - }) + "ApplicationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ApplicationNameRef, + Selector: mg.Spec.InitProvider.ApplicationNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationName") } diff --git a/apis/kinesisvideo/v1beta1/zz_generated.resolvers.go b/apis/kinesisvideo/v1beta1/zz_generated.resolvers.go index d98730f029..548c829db2 100644 --- a/apis/kinesisvideo/v1beta1/zz_generated.resolvers.go +++ b/apis/kinesisvideo/v1beta1/zz_generated.resolvers.go @@ -9,43 +9,65 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Stream. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Stream. func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } diff --git a/apis/kms/v1beta1/zz_generated.resolvers.go b/apis/kms/v1beta1/zz_generated.resolvers.go index c819e735ea..4a4a3256f1 100644 --- a/apis/kms/v1beta1/zz_generated.resolvers.go +++ b/apis/kms/v1beta1/zz_generated.resolvers.go @@ -10,44 +10,66 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Alias. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Alias. func (mg *Alias) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TargetKeyIDRef, - Selector: mg.Spec.ForProvider.TargetKeyIDSelector, - To: reference.To{ - List: &KeyList{}, - Managed: &Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TargetKeyIDRef, + Selector: mg.Spec.ForProvider.TargetKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetKeyID") } mg.Spec.ForProvider.TargetKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TargetKeyIDRef, - Selector: mg.Spec.InitProvider.TargetKeyIDSelector, - To: reference.To{ - List: &KeyList{}, - Managed: &Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TargetKeyIDRef, + Selector: mg.Spec.InitProvider.TargetKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetKeyID") } @@ -59,37 +81,56 @@ func (mg *Alias) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this Ciphertext. func (mg *Ciphertext) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KeyIDRef, - Selector: mg.Spec.ForProvider.KeyIDSelector, - To: reference.To{ - List: &KeyList{}, - Managed: &Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KeyIDRef, + Selector: mg.Spec.ForProvider.KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KeyID") } mg.Spec.ForProvider.KeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KeyIDRef, - Selector: mg.Spec.InitProvider.KeyIDSelector, - To: reference.To{ - List: &KeyList{}, - Managed: &Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KeyIDRef, + Selector: mg.Spec.InitProvider.KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KeyID") } @@ -101,69 +142,108 @@ func (mg *Ciphertext) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Grant. func (mg *Grant) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GranteePrincipal), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.GranteePrincipalRef, - Selector: mg.Spec.ForProvider.GranteePrincipalSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GranteePrincipal), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.GranteePrincipalRef, + Selector: mg.Spec.ForProvider.GranteePrincipalSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GranteePrincipal") } mg.Spec.ForProvider.GranteePrincipal = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GranteePrincipalRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.KeyIDRef, - Selector: mg.Spec.ForProvider.KeyIDSelector, - To: reference.To{ - List: &KeyList{}, - Managed: &Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.KeyIDRef, + Selector: mg.Spec.ForProvider.KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KeyID") } mg.Spec.ForProvider.KeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GranteePrincipal), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.GranteePrincipalRef, - Selector: mg.Spec.InitProvider.GranteePrincipalSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GranteePrincipal), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.GranteePrincipalRef, + Selector: mg.Spec.InitProvider.GranteePrincipalSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GranteePrincipal") } mg.Spec.InitProvider.GranteePrincipal = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GranteePrincipalRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.KeyIDRef, - Selector: mg.Spec.InitProvider.KeyIDSelector, - To: reference.To{ - List: &KeyList{}, - Managed: &Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.KeyIDRef, + Selector: mg.Spec.InitProvider.KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KeyID") } @@ -175,37 +255,58 @@ func (mg *Grant) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this ReplicaExternalKey. func (mg *ReplicaExternalKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "ExternalKey", + "ExternalKeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrimaryKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.PrimaryKeyArnRef, - Selector: mg.Spec.ForProvider.PrimaryKeyArnSelector, - To: reference.To{ - List: &ExternalKeyList{}, - Managed: &ExternalKey{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrimaryKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.PrimaryKeyArnRef, + Selector: mg.Spec.ForProvider.PrimaryKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrimaryKeyArn") } mg.Spec.ForProvider.PrimaryKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrimaryKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "ExternalKey", + "ExternalKeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrimaryKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.PrimaryKeyArnRef, - Selector: mg.Spec.InitProvider.PrimaryKeyArnSelector, - To: reference.To{ - List: &ExternalKeyList{}, - Managed: &ExternalKey{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrimaryKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.PrimaryKeyArnRef, + Selector: mg.Spec.InitProvider.PrimaryKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PrimaryKeyArn") } @@ -217,37 +318,56 @@ func (mg *ReplicaExternalKey) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this ReplicaKey. func (mg *ReplicaKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrimaryKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.PrimaryKeyArnRef, - Selector: mg.Spec.ForProvider.PrimaryKeyArnSelector, - To: reference.To{ - List: &KeyList{}, - Managed: &Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrimaryKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.PrimaryKeyArnRef, + Selector: mg.Spec.ForProvider.PrimaryKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrimaryKeyArn") } mg.Spec.ForProvider.PrimaryKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrimaryKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrimaryKeyArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.PrimaryKeyArnRef, - Selector: mg.Spec.InitProvider.PrimaryKeyArnSelector, - To: reference.To{ - List: &KeyList{}, - Managed: &Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrimaryKeyArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.PrimaryKeyArnRef, + Selector: mg.Spec.InitProvider.PrimaryKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PrimaryKeyArn") } diff --git a/apis/lakeformation/v1beta1/zz_generated.resolvers.go b/apis/lakeformation/v1beta1/zz_generated.resolvers.go index cba22c8551..c5bcf0aa9b 100644 --- a/apis/lakeformation/v1beta1/zz_generated.resolvers.go +++ b/apis/lakeformation/v1beta1/zz_generated.resolvers.go @@ -10,30 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Permissions. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Permissions. func (mg *Permissions) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.DataLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataLocation[i3].Arn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.DataLocation[i3].ArnRef, - Selector: mg.Spec.ForProvider.DataLocation[i3].ArnSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lakeformation.aws.upbound.io", + + "v1beta1", + "Resource", + + "ResourceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DataLocation[i3].Arn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.DataLocation[i3].ArnRef, + Selector: mg.Spec.ForProvider.DataLocation[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DataLocation[i3].Arn") } @@ -42,16 +56,27 @@ func (mg *Permissions) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.ForProvider.Database); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Database[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.Database[i3].NameRef, - Selector: mg.Spec.ForProvider.Database[i3].NameSelector, - To: reference.To{ - List: &v1beta1.CatalogDatabaseList{}, - Managed: &v1beta1.CatalogDatabase{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogDatabase", + + "CatalogDatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Database[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.Database[i3].NameRef, + Selector: mg.Spec.ForProvider.Database[i3].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Database[i3].Name") } @@ -60,16 +85,26 @@ func (mg *Permissions) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.ForProvider.TableWithColumns); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TableWithColumns[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TableWithColumns[i3].NameRef, - Selector: mg.Spec.ForProvider.TableWithColumns[i3].NameSelector, - To: reference.To{ - List: &v1beta1.CatalogTableList{}, - Managed: &v1beta1.CatalogTable{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogTable", + "CatalogTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TableWithColumns[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TableWithColumns[i3].NameRef, + Selector: mg.Spec.ForProvider.TableWithColumns[i3].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TableWithColumns[i3].Name") } @@ -78,16 +113,25 @@ func (mg *Permissions) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.DataLocation); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataLocation[i3].Arn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.DataLocation[i3].ArnRef, - Selector: mg.Spec.InitProvider.DataLocation[i3].ArnSelector, - To: reference.To{ - List: &ResourceList{}, - Managed: &Resource{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lakeformation.aws.upbound.io", + + "v1beta1", + "Resource", + + "ResourceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DataLocation[i3].Arn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.DataLocation[i3].ArnRef, + Selector: mg.Spec.InitProvider.DataLocation[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DataLocation[i3].Arn") } @@ -96,16 +140,27 @@ func (mg *Permissions) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.Database); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Database[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.Database[i3].NameRef, - Selector: mg.Spec.InitProvider.Database[i3].NameSelector, - To: reference.To{ - List: &v1beta1.CatalogDatabaseList{}, - Managed: &v1beta1.CatalogDatabase{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogDatabase", + + "CatalogDatabaseList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Database[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.Database[i3].NameRef, + Selector: mg.Spec.InitProvider.Database[i3].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Database[i3].Name") } @@ -114,16 +169,26 @@ func (mg *Permissions) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.TableWithColumns); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TableWithColumns[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TableWithColumns[i3].NameRef, - Selector: mg.Spec.InitProvider.TableWithColumns[i3].NameSelector, - To: reference.To{ - List: &v1beta1.CatalogTableList{}, - Managed: &v1beta1.CatalogTable{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("glue.aws.upbound.io", + + "v1beta1", + + "CatalogTable", + "CatalogTableList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TableWithColumns[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TableWithColumns[i3].NameRef, + Selector: mg.Spec.InitProvider.TableWithColumns[i3].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TableWithColumns[i3].Name") } @@ -137,37 +202,60 @@ func (mg *Permissions) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Resource. func (mg *Resource) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/lambda/v1beta1/zz_generated.resolvers.go b/apis/lambda/v1beta1/zz_generated.resolvers.go index dd77f04de6..32df4a513e 100644 --- a/apis/lambda/v1beta1/zz_generated.resolvers.go +++ b/apis/lambda/v1beta1/zz_generated.resolvers.go @@ -10,35 +10,43 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta13 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/efs/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta15 "github.com/upbound/provider-aws/apis/s3/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/signer/v1beta1" - v1beta17 "github.com/upbound/provider-aws/apis/sns/v1beta1" - v1beta16 "github.com/upbound/provider-aws/apis/sqs/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Alias. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Alias. func (mg *Alias) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.FunctionNameRef, - Selector: mg.Spec.ForProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.FunctionNameRef, + Selector: mg.Spec.ForProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FunctionName") } @@ -50,22 +58,35 @@ func (mg *Alias) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this CodeSigningConfig. func (mg *CodeSigningConfig) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.AllowedPublishers); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.AllowedPublishers[i3].SigningProfileVersionArns), - Extract: common.ARNExtractor(), - References: mg.Spec.ForProvider.AllowedPublishers[i3].SigningProfileVersionArnsRefs, - Selector: mg.Spec.ForProvider.AllowedPublishers[i3].SigningProfileVersionArnsSelector, - To: reference.To{ - List: &v1beta1.SigningProfileList{}, - Managed: &v1beta1.SigningProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("signer.aws.upbound.io", + + "v1beta1", + + "SigningProfile", + + "SigningProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.AllowedPublishers[i3].SigningProfileVersionArns), + Extract: common.ARNExtractor(), + References: mg.Spec.ForProvider.AllowedPublishers[i3].SigningProfileVersionArnsRefs, + Selector: mg.Spec.ForProvider.AllowedPublishers[i3].SigningProfileVersionArnsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AllowedPublishers[i3].SigningProfileVersionArns") } @@ -74,16 +95,26 @@ func (mg *CodeSigningConfig) ResolveReferences(ctx context.Context, c client.Rea } for i3 := 0; i3 < len(mg.Spec.InitProvider.AllowedPublishers); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.AllowedPublishers[i3].SigningProfileVersionArns), - Extract: common.ARNExtractor(), - References: mg.Spec.InitProvider.AllowedPublishers[i3].SigningProfileVersionArnsRefs, - Selector: mg.Spec.InitProvider.AllowedPublishers[i3].SigningProfileVersionArnsSelector, - To: reference.To{ - List: &v1beta1.SigningProfileList{}, - Managed: &v1beta1.SigningProfile{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("signer.aws.upbound.io", + + "v1beta1", + + "SigningProfile", + + "SigningProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.AllowedPublishers[i3].SigningProfileVersionArns), + Extract: common.ARNExtractor(), + References: mg.Spec.InitProvider.AllowedPublishers[i3].SigningProfileVersionArnsRefs, + Selector: mg.Spec.InitProvider.AllowedPublishers[i3].SigningProfileVersionArnsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AllowedPublishers[i3].SigningProfileVersionArns") } @@ -97,37 +128,58 @@ func (mg *CodeSigningConfig) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this EventSourceMapping. func (mg *EventSourceMapping) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.FunctionNameRef, - Selector: mg.Spec.ForProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.FunctionNameRef, + Selector: mg.Spec.ForProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FunctionName") } mg.Spec.ForProvider.FunctionName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FunctionNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FunctionName), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.FunctionNameRef, - Selector: mg.Spec.InitProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FunctionName), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.FunctionNameRef, + Selector: mg.Spec.InitProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FunctionName") } @@ -139,6 +191,9 @@ func (mg *EventSourceMapping) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this Function. func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -146,16 +201,26 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.FileSystemConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemConfig[i3].Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.FileSystemConfig[i3].ArnRef, - Selector: mg.Spec.ForProvider.FileSystemConfig[i3].ArnSelector, - To: reference.To{ - List: &v1beta11.AccessPointList{}, - Managed: &v1beta11.AccessPoint{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "AccessPoint", + "AccessPointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FileSystemConfig[i3].Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.FileSystemConfig[i3].ArnRef, + Selector: mg.Spec.ForProvider.FileSystemConfig[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FileSystemConfig[i3].Arn") } @@ -163,64 +228,101 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.FileSystemConfig[i3].ArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.ReplacementSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.ReplacementSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.ReplacementSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.ReplacementSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.ReplacementSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.ReplacementSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ReplacementSecurityGroupIds") } mg.Spec.ForProvider.ReplacementSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.ReplacementSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleRef, - Selector: mg.Spec.ForProvider.RoleSelector, - To: reference.To{ - List: &v1beta14.RoleList{}, - Managed: &v1beta14.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleRef, + Selector: mg.Spec.ForProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Role") } mg.Spec.ForProvider.Role = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.S3BucketRef, - Selector: mg.Spec.ForProvider.S3BucketSelector, - To: reference.To{ - List: &v1beta15.BucketList{}, - Managed: &v1beta15.Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.S3BucketRef, + Selector: mg.Spec.ForProvider.S3BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3Bucket") } @@ -228,16 +330,26 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.S3BucketRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SecurityGroupIds") } @@ -246,16 +358,26 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.ForProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfig[i3].SubnetIds") } @@ -264,16 +386,26 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.FileSystemConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemConfig[i3].Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.FileSystemConfig[i3].ArnRef, - Selector: mg.Spec.InitProvider.FileSystemConfig[i3].ArnSelector, - To: reference.To{ - List: &v1beta11.AccessPointList{}, - Managed: &v1beta11.AccessPoint{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("efs.aws.upbound.io", + + "v1beta1", + + "AccessPoint", + "AccessPointList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FileSystemConfig[i3].Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.FileSystemConfig[i3].ArnRef, + Selector: mg.Spec.InitProvider.FileSystemConfig[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FileSystemConfig[i3].Arn") } @@ -281,64 +413,101 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.FileSystemConfig[i3].ArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } mg.Spec.InitProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.ReplacementSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.ReplacementSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.ReplacementSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.ReplacementSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.ReplacementSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.ReplacementSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ReplacementSecurityGroupIds") } mg.Spec.InitProvider.ReplacementSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.ReplacementSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleRef, - Selector: mg.Spec.InitProvider.RoleSelector, - To: reference.To{ - List: &v1beta14.RoleList{}, - Managed: &v1beta14.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleRef, + Selector: mg.Spec.InitProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Role") } mg.Spec.InitProvider.Role = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RoleRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Bucket), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.S3BucketRef, - Selector: mg.Spec.InitProvider.S3BucketSelector, - To: reference.To{ - List: &v1beta15.BucketList{}, - Managed: &v1beta15.Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Bucket), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.S3BucketRef, + Selector: mg.Spec.InitProvider.S3BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.S3Bucket") } @@ -346,16 +515,26 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.S3BucketRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta13.SecurityGroupList{}, - Managed: &v1beta13.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SecurityGroupIds") } @@ -364,16 +543,26 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfig); i3++ { - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, - Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCConfig[i3].SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDRefs, + Selector: mg.Spec.InitProvider.VPCConfig[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfig[i3].SubnetIds") } @@ -387,6 +576,9 @@ func (mg *Function) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this FunctionEventInvokeConfig. func (mg *FunctionEventInvokeConfig) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -394,16 +586,26 @@ func (mg *FunctionEventInvokeConfig) ResolveReferences(ctx context.Context, c cl for i3 := 0; i3 < len(mg.Spec.ForProvider.DestinationConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.DestinationConfig[i3].OnFailure); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationConfig[i3].OnFailure[i4].Destination), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.DestinationConfig[i3].OnFailure[i4].DestinationRef, - Selector: mg.Spec.ForProvider.DestinationConfig[i3].OnFailure[i4].DestinationSelector, - To: reference.To{ - List: &v1beta16.QueueList{}, - Managed: &v1beta16.Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationConfig[i3].OnFailure[i4].Destination), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.DestinationConfig[i3].OnFailure[i4].DestinationRef, + Selector: mg.Spec.ForProvider.DestinationConfig[i3].OnFailure[i4].DestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DestinationConfig[i3].OnFailure[i4].Destination") } @@ -414,16 +616,26 @@ func (mg *FunctionEventInvokeConfig) ResolveReferences(ctx context.Context, c cl } for i3 := 0; i3 < len(mg.Spec.ForProvider.DestinationConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.DestinationConfig[i3].OnSuccess); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationConfig[i3].OnSuccess[i4].Destination), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.DestinationConfig[i3].OnSuccess[i4].DestinationRef, - Selector: mg.Spec.ForProvider.DestinationConfig[i3].OnSuccess[i4].DestinationSelector, - To: reference.To{ - List: &v1beta17.TopicList{}, - Managed: &v1beta17.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DestinationConfig[i3].OnSuccess[i4].Destination), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.DestinationConfig[i3].OnSuccess[i4].DestinationRef, + Selector: mg.Spec.ForProvider.DestinationConfig[i3].OnSuccess[i4].DestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DestinationConfig[i3].OnSuccess[i4].Destination") } @@ -434,16 +646,26 @@ func (mg *FunctionEventInvokeConfig) ResolveReferences(ctx context.Context, c cl } for i3 := 0; i3 < len(mg.Spec.InitProvider.DestinationConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.DestinationConfig[i3].OnFailure); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationConfig[i3].OnFailure[i4].Destination), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.DestinationConfig[i3].OnFailure[i4].DestinationRef, - Selector: mg.Spec.InitProvider.DestinationConfig[i3].OnFailure[i4].DestinationSelector, - To: reference.To{ - List: &v1beta16.QueueList{}, - Managed: &v1beta16.Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationConfig[i3].OnFailure[i4].Destination), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.DestinationConfig[i3].OnFailure[i4].DestinationRef, + Selector: mg.Spec.InitProvider.DestinationConfig[i3].OnFailure[i4].DestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DestinationConfig[i3].OnFailure[i4].Destination") } @@ -454,16 +676,26 @@ func (mg *FunctionEventInvokeConfig) ResolveReferences(ctx context.Context, c cl } for i3 := 0; i3 < len(mg.Spec.InitProvider.DestinationConfig); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.DestinationConfig[i3].OnSuccess); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationConfig[i3].OnSuccess[i4].Destination), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.DestinationConfig[i3].OnSuccess[i4].DestinationRef, - Selector: mg.Spec.InitProvider.DestinationConfig[i3].OnSuccess[i4].DestinationSelector, - To: reference.To{ - List: &v1beta17.TopicList{}, - Managed: &v1beta17.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DestinationConfig[i3].OnSuccess[i4].Destination), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.DestinationConfig[i3].OnSuccess[i4].DestinationRef, + Selector: mg.Spec.InitProvider.DestinationConfig[i3].OnSuccess[i4].DestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DestinationConfig[i3].OnSuccess[i4].Destination") } @@ -478,37 +710,58 @@ func (mg *FunctionEventInvokeConfig) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this FunctionURL. func (mg *FunctionURL) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.FunctionNameRef, - Selector: mg.Spec.ForProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.FunctionNameRef, + Selector: mg.Spec.ForProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FunctionName") } mg.Spec.ForProvider.FunctionName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FunctionNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FunctionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.FunctionNameRef, - Selector: mg.Spec.InitProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FunctionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.FunctionNameRef, + Selector: mg.Spec.InitProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FunctionName") } @@ -520,37 +773,58 @@ func (mg *FunctionURL) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Invocation. func (mg *Invocation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.FunctionNameRef, - Selector: mg.Spec.ForProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.FunctionNameRef, + Selector: mg.Spec.ForProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FunctionName") } mg.Spec.ForProvider.FunctionName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FunctionNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FunctionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.FunctionNameRef, - Selector: mg.Spec.InitProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FunctionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.FunctionNameRef, + Selector: mg.Spec.InitProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FunctionName") } @@ -562,69 +836,108 @@ func (mg *Invocation) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Permission. func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.FunctionNameRef, - Selector: mg.Spec.ForProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FunctionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.FunctionNameRef, + Selector: mg.Spec.ForProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FunctionName") } mg.Spec.ForProvider.FunctionName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FunctionNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Qualifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.QualifierRef, - Selector: mg.Spec.ForProvider.QualifierSelector, - To: reference.To{ - List: &AliasList{}, - Managed: &Alias{}, - }, - }) + "Alias", + "AliasList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Qualifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.QualifierRef, + Selector: mg.Spec.ForProvider.QualifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Qualifier") } mg.Spec.ForProvider.Qualifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.QualifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FunctionName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.FunctionNameRef, - Selector: mg.Spec.InitProvider.FunctionNameSelector, - To: reference.To{ - List: &FunctionList{}, - Managed: &Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FunctionName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.FunctionNameRef, + Selector: mg.Spec.InitProvider.FunctionNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FunctionName") } mg.Spec.InitProvider.FunctionName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.FunctionNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Qualifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.QualifierRef, - Selector: mg.Spec.InitProvider.QualifierSelector, - To: reference.To{ - List: &AliasList{}, - Managed: &Alias{}, - }, - }) + "v1beta1", + + "Alias", + "AliasList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Qualifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.QualifierRef, + Selector: mg.Spec.InitProvider.QualifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Qualifier") } diff --git a/apis/licensemanager/v1beta1/zz_generated.resolvers.go b/apis/licensemanager/v1beta1/zz_generated.resolvers.go index 0f5dc99f31..fa47e77a2b 100644 --- a/apis/licensemanager/v1beta1/zz_generated.resolvers.go +++ b/apis/licensemanager/v1beta1/zz_generated.resolvers.go @@ -10,76 +10,116 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Association. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Association. func (mg *Association) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("licensemanager.aws.upbound.io", + + "v1beta1", + "LicenseConfiguration", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LicenseConfigurationArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LicenseConfigurationArnRef, - Selector: mg.Spec.ForProvider.LicenseConfigurationArnSelector, - To: reference.To{ - List: &LicenseConfigurationList{}, - Managed: &LicenseConfiguration{}, - }, - }) + "LicenseConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LicenseConfigurationArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LicenseConfigurationArnRef, + Selector: mg.Spec.ForProvider.LicenseConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LicenseConfigurationArn") } mg.Spec.ForProvider.LicenseConfigurationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LicenseConfigurationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceArnRef, - Selector: mg.Spec.ForProvider.ResourceArnSelector, - To: reference.To{ - List: &v1beta1.InstanceList{}, - Managed: &v1beta1.Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceArnRef, + Selector: mg.Spec.ForProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceArn") } mg.Spec.ForProvider.ResourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("licensemanager.aws.upbound.io", + + "v1beta1", + "LicenseConfiguration", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LicenseConfigurationArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LicenseConfigurationArnRef, - Selector: mg.Spec.InitProvider.LicenseConfigurationArnSelector, - To: reference.To{ - List: &LicenseConfigurationList{}, - Managed: &LicenseConfiguration{}, - }, - }) + "LicenseConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LicenseConfigurationArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LicenseConfigurationArnRef, + Selector: mg.Spec.InitProvider.LicenseConfigurationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LicenseConfigurationArn") } mg.Spec.InitProvider.LicenseConfigurationArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.LicenseConfigurationArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceArnRef, - Selector: mg.Spec.InitProvider.ResourceArnSelector, - To: reference.To{ - List: &v1beta1.InstanceList{}, - Managed: &v1beta1.Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceArnRef, + Selector: mg.Spec.InitProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceArn") } diff --git a/apis/lightsail/v1beta1/zz_generated.resolvers.go b/apis/lightsail/v1beta1/zz_generated.resolvers.go index 2f00ddc1cf..b4705a8dac 100644 --- a/apis/lightsail/v1beta1/zz_generated.resolvers.go +++ b/apis/lightsail/v1beta1/zz_generated.resolvers.go @@ -8,76 +8,120 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this DiskAttachment. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this DiskAttachment. func (mg *DiskAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DiskName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DiskNameRef, - Selector: mg.Spec.ForProvider.DiskNameSelector, - To: reference.To{ - List: &DiskList{}, - Managed: &Disk{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Disk", + "DiskList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DiskName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DiskNameRef, + Selector: mg.Spec.ForProvider.DiskNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DiskName") } mg.Spec.ForProvider.DiskName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DiskNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.InstanceNameRef, - Selector: mg.Spec.ForProvider.InstanceNameSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Instance", + + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.InstanceNameRef, + Selector: mg.Spec.ForProvider.InstanceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceName") } mg.Spec.ForProvider.InstanceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DiskName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DiskNameRef, - Selector: mg.Spec.InitProvider.DiskNameSelector, - To: reference.To{ - List: &DiskList{}, - Managed: &Disk{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Disk", + "DiskList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DiskName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DiskNameRef, + Selector: mg.Spec.InitProvider.DiskNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DiskName") } mg.Spec.InitProvider.DiskName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DiskNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.InstanceNameRef, - Selector: mg.Spec.InitProvider.InstanceNameSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Instance", + + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.InstanceNameRef, + Selector: mg.Spec.InitProvider.InstanceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceName") } @@ -89,21 +133,33 @@ func (mg *DiskAttachment) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this DomainEntry. func (mg *DomainEntry) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), - Extract: resource.ExtractParamPath("domain_name", false), - Reference: mg.Spec.ForProvider.DomainNameRef, - Selector: mg.Spec.ForProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), + Extract: resource.ExtractParamPath("domain_name", false), + Reference: mg.Spec.ForProvider.DomainNameRef, + Selector: mg.Spec.ForProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainName") } @@ -115,37 +171,60 @@ func (mg *DomainEntry) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this InstancePublicPorts. func (mg *InstancePublicPorts) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.InstanceNameRef, - Selector: mg.Spec.ForProvider.InstanceNameSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Instance", + + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.InstanceNameRef, + Selector: mg.Spec.ForProvider.InstanceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceName") } mg.Spec.ForProvider.InstanceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.InstanceNameRef, - Selector: mg.Spec.InitProvider.InstanceNameSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Instance", + + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.InstanceNameRef, + Selector: mg.Spec.InitProvider.InstanceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceName") } @@ -157,69 +236,110 @@ func (mg *InstancePublicPorts) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this LBAttachment. func (mg *LBAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.InstanceNameRef, - Selector: mg.Spec.ForProvider.InstanceNameSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Instance", + + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.InstanceNameRef, + Selector: mg.Spec.ForProvider.InstanceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceName") } mg.Spec.ForProvider.InstanceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LBName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.LBNameRef, - Selector: mg.Spec.ForProvider.LBNameSelector, - To: reference.To{ - List: &LBList{}, - Managed: &LB{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "LB", + "LBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LBName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.LBNameRef, + Selector: mg.Spec.ForProvider.LBNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LBName") } mg.Spec.ForProvider.LBName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LBNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.InstanceNameRef, - Selector: mg.Spec.InitProvider.InstanceNameSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Instance", + + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.InstanceNameRef, + Selector: mg.Spec.InitProvider.InstanceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceName") } mg.Spec.InitProvider.InstanceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.InstanceNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LBName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.LBNameRef, - Selector: mg.Spec.InitProvider.LBNameSelector, - To: reference.To{ - List: &LBList{}, - Managed: &LB{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "LB", + "LBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LBName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.LBNameRef, + Selector: mg.Spec.InitProvider.LBNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LBName") } @@ -231,21 +351,33 @@ func (mg *LBAttachment) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this LBCertificate. func (mg *LBCertificate) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LBName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.LBNameRef, - Selector: mg.Spec.ForProvider.LBNameSelector, - To: reference.To{ - List: &LBList{}, - Managed: &LB{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "LB", + "LBList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LBName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.LBNameRef, + Selector: mg.Spec.ForProvider.LBNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LBName") } @@ -257,69 +389,112 @@ func (mg *LBCertificate) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this StaticIPAttachment. func (mg *StaticIPAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InstanceNameRef, - Selector: mg.Spec.ForProvider.InstanceNameSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Instance", + + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InstanceNameRef, + Selector: mg.Spec.ForProvider.InstanceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InstanceName") } mg.Spec.ForProvider.InstanceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.InstanceNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StaticIPName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StaticIPNameRef, - Selector: mg.Spec.ForProvider.StaticIPNameSelector, - To: reference.To{ - List: &StaticIPList{}, - Managed: &StaticIP{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "StaticIP", + + "StaticIPList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StaticIPName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StaticIPNameRef, + Selector: mg.Spec.ForProvider.StaticIPNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StaticIPName") } mg.Spec.ForProvider.StaticIPName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StaticIPNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InstanceNameRef, - Selector: mg.Spec.InitProvider.InstanceNameSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "Instance", + + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InstanceNameRef, + Selector: mg.Spec.InitProvider.InstanceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InstanceName") } mg.Spec.InitProvider.InstanceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.InstanceNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StaticIPName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StaticIPNameRef, - Selector: mg.Spec.InitProvider.StaticIPNameSelector, - To: reference.To{ - List: &StaticIPList{}, - Managed: &StaticIP{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lightsail.aws.upbound.io", + + "v1beta1", + + "StaticIP", + + "StaticIPList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StaticIPName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StaticIPNameRef, + Selector: mg.Spec.InitProvider.StaticIPNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StaticIPName") } diff --git a/apis/location/v1beta1/zz_generated.resolvers.go b/apis/location/v1beta1/zz_generated.resolvers.go index fb466dce33..faaa6e36a1 100644 --- a/apis/location/v1beta1/zz_generated.resolvers.go +++ b/apis/location/v1beta1/zz_generated.resolvers.go @@ -10,43 +10,65 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this GeofenceCollection. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this GeofenceCollection. func (mg *GeofenceCollection) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -58,37 +80,56 @@ func (mg *GeofenceCollection) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this Tracker. func (mg *Tracker) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -100,69 +141,108 @@ func (mg *Tracker) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this TrackerAssociation. func (mg *TrackerAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("location.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConsumerArn), - Extract: resource.ExtractParamPath("collection_arn", true), - Reference: mg.Spec.ForProvider.ConsumerArnRef, - Selector: mg.Spec.ForProvider.ConsumerArnSelector, - To: reference.To{ - List: &GeofenceCollectionList{}, - Managed: &GeofenceCollection{}, - }, - }) + "v1beta1", + + "GeofenceCollection", + + "GeofenceCollectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConsumerArn), + Extract: resource.ExtractParamPath("collection_arn", true), + Reference: mg.Spec.ForProvider.ConsumerArnRef, + Selector: mg.Spec.ForProvider.ConsumerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConsumerArn") } mg.Spec.ForProvider.ConsumerArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConsumerArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TrackerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TrackerNameRef, - Selector: mg.Spec.ForProvider.TrackerNameSelector, - To: reference.To{ - List: &TrackerList{}, - Managed: &Tracker{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("location.aws.upbound.io", + + "v1beta1", + + "Tracker", + "TrackerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TrackerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TrackerNameRef, + Selector: mg.Spec.ForProvider.TrackerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TrackerName") } mg.Spec.ForProvider.TrackerName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TrackerNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("location.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConsumerArn), - Extract: resource.ExtractParamPath("collection_arn", true), - Reference: mg.Spec.InitProvider.ConsumerArnRef, - Selector: mg.Spec.InitProvider.ConsumerArnSelector, - To: reference.To{ - List: &GeofenceCollectionList{}, - Managed: &GeofenceCollection{}, - }, - }) + "v1beta1", + + "GeofenceCollection", + + "GeofenceCollectionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConsumerArn), + Extract: resource.ExtractParamPath("collection_arn", true), + Reference: mg.Spec.InitProvider.ConsumerArnRef, + Selector: mg.Spec.InitProvider.ConsumerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConsumerArn") } mg.Spec.InitProvider.ConsumerArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConsumerArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TrackerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TrackerNameRef, - Selector: mg.Spec.InitProvider.TrackerNameSelector, - To: reference.To{ - List: &TrackerList{}, - Managed: &Tracker{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("location.aws.upbound.io", + + "v1beta1", + + "Tracker", + "TrackerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TrackerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TrackerNameRef, + Selector: mg.Spec.InitProvider.TrackerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TrackerName") } diff --git a/apis/medialive/v1beta1/zz_generated.resolvers.go b/apis/medialive/v1beta1/zz_generated.resolvers.go index 0d140afc07..9493be0f8d 100644 --- a/apis/medialive/v1beta1/zz_generated.resolvers.go +++ b/apis/medialive/v1beta1/zz_generated.resolvers.go @@ -10,29 +10,45 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Channel. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Channel. func (mg *Channel) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.InputAttachments); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InputAttachments[i3].InputID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.InputAttachments[i3].InputIDRef, - Selector: mg.Spec.ForProvider.InputAttachments[i3].InputIDSelector, - To: reference.To{ - List: &InputList{}, - Managed: &Input{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("medialive.aws.upbound.io", + + "v1beta1", + + "Input", + "InputList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InputAttachments[i3].InputID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.InputAttachments[i3].InputIDRef, + Selector: mg.Spec.ForProvider.InputAttachments[i3].InputIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InputAttachments[i3].InputID") } @@ -40,16 +56,27 @@ func (mg *Channel) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.InputAttachments[i3].InputIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } @@ -57,16 +84,26 @@ func (mg *Channel) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.InputAttachments); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InputAttachments[i3].InputID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.InputAttachments[i3].InputIDRef, - Selector: mg.Spec.InitProvider.InputAttachments[i3].InputIDSelector, - To: reference.To{ - List: &InputList{}, - Managed: &Input{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("medialive.aws.upbound.io", + + "v1beta1", + + "Input", + "InputList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InputAttachments[i3].InputID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.InputAttachments[i3].InputIDRef, + Selector: mg.Spec.InitProvider.InputAttachments[i3].InputIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InputAttachments[i3].InputID") } @@ -74,16 +111,27 @@ func (mg *Channel) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.InputAttachments[i3].InputIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -95,37 +143,60 @@ func (mg *Channel) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Input. func (mg *Input) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/mediastore/v1beta1/zz_generated.resolvers.go b/apis/mediastore/v1beta1/zz_generated.resolvers.go index e070530ed6..4979c4843a 100644 --- a/apis/mediastore/v1beta1/zz_generated.resolvers.go +++ b/apis/mediastore/v1beta1/zz_generated.resolvers.go @@ -8,43 +8,69 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ContainerPolicy. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ContainerPolicy. func (mg *ContainerPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("mediastore.aws.upbound.io", + + "v1beta1", + + "Container", + + "ContainerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ContainerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ContainerNameRef, - Selector: mg.Spec.ForProvider.ContainerNameSelector, - To: reference.To{ - List: &ContainerList{}, - Managed: &Container{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ContainerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ContainerNameRef, + Selector: mg.Spec.ForProvider.ContainerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ContainerName") } mg.Spec.ForProvider.ContainerName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ContainerNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("mediastore.aws.upbound.io", + + "v1beta1", + + "Container", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ContainerName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ContainerNameRef, - Selector: mg.Spec.InitProvider.ContainerNameSelector, - To: reference.To{ - List: &ContainerList{}, - Managed: &Container{}, - }, - }) + "ContainerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ContainerName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ContainerNameRef, + Selector: mg.Spec.InitProvider.ContainerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ContainerName") } diff --git a/apis/memorydb/v1beta1/zz_generated.resolvers.go b/apis/memorydb/v1beta1/zz_generated.resolvers.go index 3f267bcc24..1443ec8476 100644 --- a/apis/memorydb/v1beta1/zz_generated.resolvers.go +++ b/apis/memorydb/v1beta1/zz_generated.resolvers.go @@ -10,109 +10,168 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Cluster. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("memorydb.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetGroupName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SubnetGroupNameRef, - Selector: mg.Spec.ForProvider.SubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetGroupName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SubnetGroupNameRef, + Selector: mg.Spec.ForProvider.SubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetGroupName") } mg.Spec.ForProvider.SubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } mg.Spec.InitProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("memorydb.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", + + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetGroupName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SubnetGroupNameRef, - Selector: mg.Spec.InitProvider.SubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetGroupName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SubnetGroupNameRef, + Selector: mg.Spec.InitProvider.SubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetGroupName") } @@ -124,69 +183,106 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Snapshot. func (mg *Snapshot) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("memorydb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterNameRef, - Selector: mg.Spec.ForProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterNameRef, + Selector: mg.Spec.ForProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterName") } mg.Spec.ForProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("memorydb.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterNameRef, - Selector: mg.Spec.InitProvider.ClusterNameSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterNameRef, + Selector: mg.Spec.InitProvider.ClusterNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterName") } mg.Spec.InitProvider.ClusterName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } @@ -198,37 +294,58 @@ func (mg *Snapshot) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this SubnetGroup. func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/mq/v1beta1/zz_generated.resolvers.go b/apis/mq/v1beta1/zz_generated.resolvers.go index 5ac7930102..ddb002ee95 100644 --- a/apis/mq/v1beta1/zz_generated.resolvers.go +++ b/apis/mq/v1beta1/zz_generated.resolvers.go @@ -10,12 +10,18 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Broker. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Broker. func (mg *Broker) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -23,16 +29,26 @@ func (mg *Broker) ResolveReferences(ctx context.Context, c client.Reader) error var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Configuration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].ID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Configuration[i3].IDRef, - Selector: mg.Spec.ForProvider.Configuration[i3].IDSelector, - To: reference.To{ - List: &ConfigurationList{}, - Managed: &Configuration{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("mq.aws.upbound.io", + + "v1beta1", + + "Configuration", + "ConfigurationList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].ID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Configuration[i3].IDRef, + Selector: mg.Spec.ForProvider.Configuration[i3].IDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Configuration[i3].ID") } @@ -40,32 +56,51 @@ func (mg *Broker) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.Configuration[i3].IDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupRefs, - Selector: mg.Spec.ForProvider.SecurityGroupSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupRefs, + Selector: mg.Spec.ForProvider.SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroups") } mg.Spec.ForProvider.SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } @@ -73,16 +108,26 @@ func (mg *Broker) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.InitProvider.Configuration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].ID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Configuration[i3].IDRef, - Selector: mg.Spec.InitProvider.Configuration[i3].IDSelector, - To: reference.To{ - List: &ConfigurationList{}, - Managed: &Configuration{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("mq.aws.upbound.io", + + "v1beta1", + + "Configuration", + "ConfigurationList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].ID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Configuration[i3].IDRef, + Selector: mg.Spec.InitProvider.Configuration[i3].IDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Configuration[i3].ID") } @@ -90,32 +135,51 @@ func (mg *Broker) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.Configuration[i3].IDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupRefs, - Selector: mg.Spec.InitProvider.SecurityGroupSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroups), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupRefs, + Selector: mg.Spec.InitProvider.SecurityGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroups") } mg.Spec.InitProvider.SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/neptune/v1beta1/zz_generated.resolvers.go b/apis/neptune/v1beta1/zz_generated.resolvers.go index 12c827610a..178d76db76 100644 --- a/apis/neptune/v1beta1/zz_generated.resolvers.go +++ b/apis/neptune/v1beta1/zz_generated.resolvers.go @@ -10,239 +10,374 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Cluster. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.IAMRoles), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.IAMRoleRefs, - Selector: mg.Spec.ForProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.IAMRoles), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.IAMRoleRefs, + Selector: mg.Spec.ForProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoles") } mg.Spec.ForProvider.IAMRoles = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.IAMRoleRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } mg.Spec.ForProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NeptuneClusterParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NeptuneClusterParameterGroupNameRef, - Selector: mg.Spec.ForProvider.NeptuneClusterParameterGroupNameSelector, - To: reference.To{ - List: &ClusterParameterGroupList{}, - Managed: &ClusterParameterGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "ClusterParameterGroup", + + "ClusterParameterGroupList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NeptuneClusterParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NeptuneClusterParameterGroupNameRef, + Selector: mg.Spec.ForProvider.NeptuneClusterParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NeptuneClusterParameterGroupName") } mg.Spec.ForProvider.NeptuneClusterParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NeptuneClusterParameterGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NeptuneSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NeptuneSubnetGroupNameRef, - Selector: mg.Spec.ForProvider.NeptuneSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", + + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NeptuneSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NeptuneSubnetGroupNameRef, + Selector: mg.Spec.ForProvider.NeptuneSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NeptuneSubnetGroupName") } mg.Spec.ForProvider.NeptuneSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NeptuneSubnetGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicationSourceIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ReplicationSourceIdentifierRef, - Selector: mg.Spec.ForProvider.ReplicationSourceIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicationSourceIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ReplicationSourceIdentifierRef, + Selector: mg.Spec.ForProvider.ReplicationSourceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ReplicationSourceIdentifier") } mg.Spec.ForProvider.ReplicationSourceIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ReplicationSourceIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "ClusterSnapshot", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnapshotIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SnapshotIdentifierRef, - Selector: mg.Spec.ForProvider.SnapshotIdentifierSelector, - To: reference.To{ - List: &ClusterSnapshotList{}, - Managed: &ClusterSnapshot{}, - }, - }) + "ClusterSnapshotList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnapshotIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SnapshotIdentifierRef, + Selector: mg.Spec.ForProvider.SnapshotIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnapshotIdentifier") } mg.Spec.ForProvider.SnapshotIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnapshotIdentifierRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.IAMRoles), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.IAMRoleRefs, - Selector: mg.Spec.InitProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.IAMRoles), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.IAMRoleRefs, + Selector: mg.Spec.InitProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoles") } mg.Spec.InitProvider.IAMRoles = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.IAMRoleRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } mg.Spec.InitProvider.KMSKeyArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NeptuneClusterParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NeptuneClusterParameterGroupNameRef, - Selector: mg.Spec.InitProvider.NeptuneClusterParameterGroupNameSelector, - To: reference.To{ - List: &ClusterParameterGroupList{}, - Managed: &ClusterParameterGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "ClusterParameterGroup", + + "ClusterParameterGroupList") + if err != nil { + return errors.Wrap(err, + "failed to get the reference target managed resource and its list for reference resolution", + ) + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NeptuneClusterParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NeptuneClusterParameterGroupNameRef, + Selector: mg.Spec.InitProvider.NeptuneClusterParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NeptuneClusterParameterGroupName") } mg.Spec.InitProvider.NeptuneClusterParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.NeptuneClusterParameterGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NeptuneSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NeptuneSubnetGroupNameRef, - Selector: mg.Spec.InitProvider.NeptuneSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", + + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NeptuneSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NeptuneSubnetGroupNameRef, + Selector: mg.Spec.InitProvider.NeptuneSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NeptuneSubnetGroupName") } mg.Spec.InitProvider.NeptuneSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.NeptuneSubnetGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicationSourceIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ReplicationSourceIdentifierRef, - Selector: mg.Spec.InitProvider.ReplicationSourceIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicationSourceIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ReplicationSourceIdentifierRef, + Selector: mg.Spec.InitProvider.ReplicationSourceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ReplicationSourceIdentifier") } mg.Spec.InitProvider.ReplicationSourceIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ReplicationSourceIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnapshotIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SnapshotIdentifierRef, - Selector: mg.Spec.InitProvider.SnapshotIdentifierSelector, - To: reference.To{ - List: &ClusterSnapshotList{}, - Managed: &ClusterSnapshot{}, - }, - }) + "ClusterSnapshot", + + "ClusterSnapshotList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnapshotIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SnapshotIdentifierRef, + Selector: mg.Spec.InitProvider.SnapshotIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnapshotIdentifier") } mg.Spec.InitProvider.SnapshotIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SnapshotIdentifierRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -254,37 +389,58 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ClusterEndpoint. func (mg *ClusterEndpoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterIdentifierRef, - Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterIdentifierRef, + Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterIdentifier") } mg.Spec.ForProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterIdentifierRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterIdentifierRef, - Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterIdentifierRef, + Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterIdentifier") } @@ -296,101 +452,160 @@ func (mg *ClusterEndpoint) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this ClusterInstance. func (mg *ClusterInstance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ClusterIdentifierRef, - Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ClusterIdentifierRef, + Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterIdentifier") } mg.Spec.ForProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NeptuneParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NeptuneParameterGroupNameRef, - Selector: mg.Spec.ForProvider.NeptuneParameterGroupNameSelector, - To: reference.To{ - List: &ParameterGroupList{}, - Managed: &ParameterGroup{}, - }, - }) + "ParameterGroup", + + "ParameterGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NeptuneParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NeptuneParameterGroupNameRef, + Selector: mg.Spec.ForProvider.NeptuneParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NeptuneParameterGroupName") } mg.Spec.ForProvider.NeptuneParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NeptuneParameterGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NeptuneSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NeptuneSubnetGroupNameRef, - Selector: mg.Spec.ForProvider.NeptuneSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", + + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NeptuneSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NeptuneSubnetGroupNameRef, + Selector: mg.Spec.ForProvider.NeptuneSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NeptuneSubnetGroupName") } mg.Spec.ForProvider.NeptuneSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NeptuneSubnetGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ClusterIdentifierRef, - Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ClusterIdentifierRef, + Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterIdentifier") } mg.Spec.InitProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "ParameterGroup", + + "ParameterGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NeptuneParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NeptuneParameterGroupNameRef, - Selector: mg.Spec.InitProvider.NeptuneParameterGroupNameSelector, - To: reference.To{ - List: &ParameterGroupList{}, - Managed: &ParameterGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NeptuneParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NeptuneParameterGroupNameRef, + Selector: mg.Spec.InitProvider.NeptuneParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NeptuneParameterGroupName") } mg.Spec.InitProvider.NeptuneParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.NeptuneParameterGroupNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NeptuneSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NeptuneSubnetGroupNameRef, - Selector: mg.Spec.InitProvider.NeptuneSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", + + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NeptuneSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NeptuneSubnetGroupNameRef, + Selector: mg.Spec.InitProvider.NeptuneSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NeptuneSubnetGroupName") } @@ -402,37 +617,58 @@ func (mg *ClusterInstance) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this ClusterSnapshot. func (mg *ClusterSnapshot) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DBClusterIdentifierRef, - Selector: mg.Spec.ForProvider.DBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DBClusterIdentifierRef, + Selector: mg.Spec.ForProvider.DBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBClusterIdentifier") } mg.Spec.ForProvider.DBClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBClusterIdentifierRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DBClusterIdentifierRef, - Selector: mg.Spec.InitProvider.DBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DBClusterIdentifierRef, + Selector: mg.Spec.InitProvider.DBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBClusterIdentifier") } @@ -444,37 +680,58 @@ func (mg *ClusterSnapshot) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this EventSubscription. func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SnsTopicArnRef, - Selector: mg.Spec.ForProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SnsTopicArnRef, + Selector: mg.Spec.ForProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnsTopicArn") } mg.Spec.ForProvider.SnsTopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnsTopicArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SnsTopicArnRef, - Selector: mg.Spec.InitProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SnsTopicArnRef, + Selector: mg.Spec.InitProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnsTopicArn") } @@ -486,37 +743,58 @@ func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this GlobalCluster. func (mg *GlobalCluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBClusterIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SourceDBClusterIdentifierRef, - Selector: mg.Spec.ForProvider.SourceDBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBClusterIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SourceDBClusterIdentifierRef, + Selector: mg.Spec.ForProvider.SourceDBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceDBClusterIdentifier") } mg.Spec.ForProvider.SourceDBClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceDBClusterIdentifierRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBClusterIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SourceDBClusterIdentifierRef, - Selector: mg.Spec.InitProvider.SourceDBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("neptune.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBClusterIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SourceDBClusterIdentifierRef, + Selector: mg.Spec.InitProvider.SourceDBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceDBClusterIdentifier") } @@ -528,37 +806,58 @@ func (mg *GlobalCluster) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this SubnetGroup. func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/networkfirewall/v1beta1/zz_generated.resolvers.go b/apis/networkfirewall/v1beta1/zz_generated.resolvers.go index c7658a032c..9dc45a711c 100644 --- a/apis/networkfirewall/v1beta1/zz_generated.resolvers.go +++ b/apis/networkfirewall/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,42 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Firewall. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Firewall. func (mg *Firewall) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("networkfirewall.aws.upbound.io", + + "v1beta1", + "FirewallPolicy", + + "FirewallPolicyList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirewallPolicyArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.FirewallPolicyArnRef, - Selector: mg.Spec.ForProvider.FirewallPolicyArnSelector, - To: reference.To{ - List: &FirewallPolicyList{}, - Managed: &FirewallPolicy{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirewallPolicyArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.FirewallPolicyArnRef, + Selector: mg.Spec.ForProvider.FirewallPolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FirewallPolicyArn") } @@ -39,16 +53,26 @@ func (mg *Firewall) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.FirewallPolicyArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.SubnetMapping); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetMapping[i3].SubnetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetMapping[i3].SubnetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetMapping[i3].SubnetID") } @@ -56,32 +80,49 @@ func (mg *Firewall) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.SubnetMapping[i3].SubnetIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("networkfirewall.aws.upbound.io", + + "v1beta1", + "FirewallPolicy", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirewallPolicyArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.FirewallPolicyArnRef, - Selector: mg.Spec.InitProvider.FirewallPolicyArnSelector, - To: reference.To{ - List: &FirewallPolicyList{}, - Managed: &FirewallPolicy{}, - }, - }) + "FirewallPolicyList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirewallPolicyArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.FirewallPolicyArnRef, + Selector: mg.Spec.InitProvider.FirewallPolicyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FirewallPolicyArn") } @@ -89,16 +130,26 @@ func (mg *Firewall) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.FirewallPolicyArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.SubnetMapping); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetMapping[i3].SubnetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetMapping[i3].SubnetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetMapping[i3].SubnetID") } @@ -106,16 +157,25 @@ func (mg *Firewall) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.SubnetMapping[i3].SubnetIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -127,6 +187,9 @@ func (mg *Firewall) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this FirewallPolicy. func (mg *FirewallPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -134,16 +197,25 @@ func (mg *FirewallPolicy) ResolveReferences(ctx context.Context, c client.Reader for i3 := 0; i3 < len(mg.Spec.ForProvider.FirewallPolicy); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.FirewallPolicy[i3].StatefulRuleGroupReference); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArnRef, - Selector: mg.Spec.ForProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArnSelector, - To: reference.To{ - List: &RuleGroupList{}, - Managed: &RuleGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkfirewall.aws.upbound.io", + + "v1beta1", + "RuleGroup", + + "RuleGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArnRef, + Selector: mg.Spec.ForProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArn") } @@ -154,16 +226,25 @@ func (mg *FirewallPolicy) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.ForProvider.FirewallPolicy); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.FirewallPolicy[i3].StatelessRuleGroupReference); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArnRef, - Selector: mg.Spec.ForProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArnSelector, - To: reference.To{ - List: &RuleGroupList{}, - Managed: &RuleGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkfirewall.aws.upbound.io", + + "v1beta1", + "RuleGroup", + + "RuleGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArnRef, + Selector: mg.Spec.ForProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArn") } @@ -174,16 +255,25 @@ func (mg *FirewallPolicy) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.FirewallPolicy); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.FirewallPolicy[i3].StatefulRuleGroupReference); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArnRef, - Selector: mg.Spec.InitProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArnSelector, - To: reference.To{ - List: &RuleGroupList{}, - Managed: &RuleGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkfirewall.aws.upbound.io", + + "v1beta1", + "RuleGroup", + + "RuleGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArnRef, + Selector: mg.Spec.InitProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FirewallPolicy[i3].StatefulRuleGroupReference[i4].ResourceArn") } @@ -194,16 +284,25 @@ func (mg *FirewallPolicy) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.FirewallPolicy); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.FirewallPolicy[i3].StatelessRuleGroupReference); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArnRef, - Selector: mg.Spec.InitProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArnSelector, - To: reference.To{ - List: &RuleGroupList{}, - Managed: &RuleGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkfirewall.aws.upbound.io", + + "v1beta1", + "RuleGroup", + + "RuleGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArnRef, + Selector: mg.Spec.InitProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FirewallPolicy[i3].StatelessRuleGroupReference[i4].ResourceArn") } @@ -218,37 +317,56 @@ func (mg *FirewallPolicy) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this LoggingConfiguration. func (mg *LoggingConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("networkfirewall.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirewallArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.FirewallArnRef, - Selector: mg.Spec.ForProvider.FirewallArnSelector, - To: reference.To{ - List: &FirewallList{}, - Managed: &Firewall{}, - }, - }) + "v1beta1", + "Firewall", + + "FirewallList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirewallArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.FirewallArnRef, + Selector: mg.Spec.ForProvider.FirewallArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FirewallArn") } mg.Spec.ForProvider.FirewallArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FirewallArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("networkfirewall.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirewallArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.FirewallArnRef, - Selector: mg.Spec.InitProvider.FirewallArnSelector, - To: reference.To{ - List: &FirewallList{}, - Managed: &Firewall{}, - }, - }) + "v1beta1", + "Firewall", + + "FirewallList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirewallArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.FirewallArnRef, + Selector: mg.Spec.InitProvider.FirewallArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FirewallArn") } @@ -260,6 +378,9 @@ func (mg *LoggingConfiguration) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this RuleGroup. func (mg *RuleGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -269,16 +390,26 @@ func (mg *RuleGroup) ResolveReferences(ctx context.Context, c client.Reader) err for i4 := 0; i4 < len(mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArnRef, - Selector: mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArnSelector, - To: reference.To{ - List: &v1beta1.ManagedPrefixListList{}, - Managed: &v1beta1.ManagedPrefixList{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArnRef, + Selector: mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArn") } @@ -293,16 +424,26 @@ func (mg *RuleGroup) ResolveReferences(ctx context.Context, c client.Reader) err for i4 := 0; i4 < len(mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArnRef, - Selector: mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArnSelector, - To: reference.To{ - List: &v1beta1.ManagedPrefixListList{}, - Managed: &v1beta1.ManagedPrefixList{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "ManagedPrefixList", + + "ManagedPrefixListList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArnRef, + Selector: mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RuleGroup[i3].ReferenceSets[i4].IPSetReferences[i5].IPSetReference[i6].ReferenceArn") } diff --git a/apis/networkmanager/v1beta1/zz_generated.resolvers.go b/apis/networkmanager/v1beta1/zz_generated.resolvers.go index 3bb8ce8392..4f38869450 100644 --- a/apis/networkmanager/v1beta1/zz_generated.resolvers.go +++ b/apis/networkmanager/v1beta1/zz_generated.resolvers.go @@ -10,76 +10,114 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AttachmentAccepter. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this AttachmentAccepter. func (mg *AttachmentAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.AttachmentIDRef, - Selector: mg.Spec.ForProvider.AttachmentIDSelector, - To: reference.To{ - List: &VPCAttachmentList{}, - Managed: &VPCAttachment{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "VPCAttachment", + + "VPCAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.AttachmentIDRef, + Selector: mg.Spec.ForProvider.AttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AttachmentID") } mg.Spec.ForProvider.AttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AttachmentIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AttachmentType), - Extract: resource.ExtractParamPath("attachment_type", true), - Reference: mg.Spec.ForProvider.AttachmentTypeRef, - Selector: mg.Spec.ForProvider.AttachmentTypeSelector, - To: reference.To{ - List: &VPCAttachmentList{}, - Managed: &VPCAttachment{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "VPCAttachment", + + "VPCAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AttachmentType), + Extract: resource.ExtractParamPath("attachment_type", true), + Reference: mg.Spec.ForProvider.AttachmentTypeRef, + Selector: mg.Spec.ForProvider.AttachmentTypeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AttachmentType") } mg.Spec.ForProvider.AttachmentType = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AttachmentTypeRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.AttachmentIDRef, - Selector: mg.Spec.InitProvider.AttachmentIDSelector, - To: reference.To{ - List: &VPCAttachmentList{}, - Managed: &VPCAttachment{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "VPCAttachment", + + "VPCAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.AttachmentIDRef, + Selector: mg.Spec.InitProvider.AttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AttachmentID") } mg.Spec.InitProvider.AttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AttachmentIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AttachmentType), - Extract: resource.ExtractParamPath("attachment_type", true), - Reference: mg.Spec.InitProvider.AttachmentTypeRef, - Selector: mg.Spec.InitProvider.AttachmentTypeSelector, - To: reference.To{ - List: &VPCAttachmentList{}, - Managed: &VPCAttachment{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "VPCAttachment", + + "VPCAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AttachmentType), + Extract: resource.ExtractParamPath("attachment_type", true), + Reference: mg.Spec.InitProvider.AttachmentTypeRef, + Selector: mg.Spec.InitProvider.AttachmentTypeSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AttachmentType") } @@ -91,101 +129,152 @@ func (mg *AttachmentAccepter) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this ConnectAttachment. func (mg *ConnectAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CoreNetworkID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CoreNetworkIDRef, - Selector: mg.Spec.ForProvider.CoreNetworkIDSelector, - To: reference.To{ - List: &CoreNetworkList{}, - Managed: &CoreNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "CoreNetwork", + + "CoreNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CoreNetworkID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CoreNetworkIDRef, + Selector: mg.Spec.ForProvider.CoreNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CoreNetworkID") } mg.Spec.ForProvider.CoreNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CoreNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EdgeLocation), - Extract: resource.ExtractParamPath("edge_location", true), - Reference: mg.Spec.ForProvider.EdgeLocationRef, - Selector: mg.Spec.ForProvider.EdgeLocationSelector, - To: reference.To{ - List: &VPCAttachmentList{}, - Managed: &VPCAttachment{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "VPCAttachment", + + "VPCAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EdgeLocation), + Extract: resource.ExtractParamPath("edge_location", true), + Reference: mg.Spec.ForProvider.EdgeLocationRef, + Selector: mg.Spec.ForProvider.EdgeLocationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EdgeLocation") } mg.Spec.ForProvider.EdgeLocation = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EdgeLocationRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransportAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TransportAttachmentIDRef, - Selector: mg.Spec.ForProvider.TransportAttachmentIDSelector, - To: reference.To{ - List: &VPCAttachmentList{}, - Managed: &VPCAttachment{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "VPCAttachment", + + "VPCAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransportAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TransportAttachmentIDRef, + Selector: mg.Spec.ForProvider.TransportAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransportAttachmentID") } mg.Spec.ForProvider.TransportAttachmentID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransportAttachmentIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CoreNetworkID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CoreNetworkIDRef, - Selector: mg.Spec.InitProvider.CoreNetworkIDSelector, - To: reference.To{ - List: &CoreNetworkList{}, - Managed: &CoreNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "CoreNetwork", + + "CoreNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CoreNetworkID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CoreNetworkIDRef, + Selector: mg.Spec.InitProvider.CoreNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CoreNetworkID") } mg.Spec.InitProvider.CoreNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CoreNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EdgeLocation), - Extract: resource.ExtractParamPath("edge_location", true), - Reference: mg.Spec.InitProvider.EdgeLocationRef, - Selector: mg.Spec.InitProvider.EdgeLocationSelector, - To: reference.To{ - List: &VPCAttachmentList{}, - Managed: &VPCAttachment{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "VPCAttachment", + + "VPCAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EdgeLocation), + Extract: resource.ExtractParamPath("edge_location", true), + Reference: mg.Spec.InitProvider.EdgeLocationRef, + Selector: mg.Spec.InitProvider.EdgeLocationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EdgeLocation") } mg.Spec.InitProvider.EdgeLocation = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.EdgeLocationRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransportAttachmentID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TransportAttachmentIDRef, - Selector: mg.Spec.InitProvider.TransportAttachmentIDSelector, - To: reference.To{ - List: &VPCAttachmentList{}, - Managed: &VPCAttachment{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "VPCAttachment", + + "VPCAttachmentList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TransportAttachmentID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TransportAttachmentIDRef, + Selector: mg.Spec.InitProvider.TransportAttachmentIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TransportAttachmentID") } @@ -197,101 +286,152 @@ func (mg *ConnectAttachment) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this Connection. func (mg *Connection) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectedDeviceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ConnectedDeviceIDRef, - Selector: mg.Spec.ForProvider.ConnectedDeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConnectedDeviceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ConnectedDeviceIDRef, + Selector: mg.Spec.ForProvider.ConnectedDeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConnectedDeviceID") } mg.Spec.ForProvider.ConnectedDeviceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConnectedDeviceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DeviceIDRef, - Selector: mg.Spec.ForProvider.DeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DeviceIDRef, + Selector: mg.Spec.ForProvider.DeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeviceID") } mg.Spec.ForProvider.DeviceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeviceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectedDeviceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ConnectedDeviceIDRef, - Selector: mg.Spec.InitProvider.ConnectedDeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConnectedDeviceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ConnectedDeviceIDRef, + Selector: mg.Spec.InitProvider.ConnectedDeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConnectedDeviceID") } mg.Spec.InitProvider.ConnectedDeviceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ConnectedDeviceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeviceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DeviceIDRef, - Selector: mg.Spec.InitProvider.DeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeviceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DeviceIDRef, + Selector: mg.Spec.InitProvider.DeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DeviceID") } mg.Spec.InitProvider.DeviceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DeviceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, - Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, + Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GlobalNetworkID") } @@ -303,37 +443,56 @@ func (mg *Connection) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this CoreNetwork. func (mg *CoreNetwork) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, - Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, + Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GlobalNetworkID") } @@ -345,69 +504,106 @@ func (mg *CoreNetwork) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this CustomerGatewayAssociation. func (mg *CustomerGatewayAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomerGatewayArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CustomerGatewayArnRef, - Selector: mg.Spec.ForProvider.CustomerGatewayArnSelector, - To: reference.To{ - List: &v1beta1.CustomerGatewayList{}, - Managed: &v1beta1.CustomerGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "CustomerGateway", + + "CustomerGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomerGatewayArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CustomerGatewayArnRef, + Selector: mg.Spec.ForProvider.CustomerGatewayArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomerGatewayArn") } mg.Spec.ForProvider.CustomerGatewayArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CustomerGatewayArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DeviceIDRef, - Selector: mg.Spec.ForProvider.DeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DeviceIDRef, + Selector: mg.Spec.ForProvider.DeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeviceID") } mg.Spec.ForProvider.DeviceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeviceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeviceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DeviceIDRef, - Selector: mg.Spec.InitProvider.DeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeviceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DeviceIDRef, + Selector: mg.Spec.InitProvider.DeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DeviceID") } @@ -419,69 +615,104 @@ func (mg *CustomerGatewayAssociation) ResolveReferences(ctx context.Context, c c // ResolveReferences of this Device. func (mg *Device) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SiteID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SiteIDRef, - Selector: mg.Spec.ForProvider.SiteIDSelector, - To: reference.To{ - List: &SiteList{}, - Managed: &Site{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Site", + "SiteList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SiteID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SiteIDRef, + Selector: mg.Spec.ForProvider.SiteIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SiteID") } mg.Spec.ForProvider.SiteID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SiteIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, - Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, + Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GlobalNetworkID") } mg.Spec.InitProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SiteID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SiteIDRef, - Selector: mg.Spec.InitProvider.SiteIDSelector, - To: reference.To{ - List: &SiteList{}, - Managed: &Site{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Site", + "SiteList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SiteID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SiteIDRef, + Selector: mg.Spec.InitProvider.SiteIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SiteID") } @@ -493,69 +724,104 @@ func (mg *Device) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Link. func (mg *Link) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SiteID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SiteIDRef, - Selector: mg.Spec.ForProvider.SiteIDSelector, - To: reference.To{ - List: &SiteList{}, - Managed: &Site{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Site", + "SiteList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SiteID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SiteIDRef, + Selector: mg.Spec.ForProvider.SiteIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SiteID") } mg.Spec.ForProvider.SiteID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SiteIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, - Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, + Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GlobalNetworkID") } mg.Spec.InitProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SiteID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SiteIDRef, - Selector: mg.Spec.InitProvider.SiteIDSelector, - To: reference.To{ - List: &SiteList{}, - Managed: &Site{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Site", + "SiteList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SiteID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SiteIDRef, + Selector: mg.Spec.InitProvider.SiteIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SiteID") } @@ -567,53 +833,80 @@ func (mg *Link) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this LinkAssociation. func (mg *LinkAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DeviceIDRef, - Selector: mg.Spec.ForProvider.DeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DeviceIDRef, + Selector: mg.Spec.ForProvider.DeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeviceID") } mg.Spec.ForProvider.DeviceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeviceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LinkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.LinkIDRef, - Selector: mg.Spec.ForProvider.LinkIDSelector, - To: reference.To{ - List: &LinkList{}, - Managed: &Link{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Link", + "LinkList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LinkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.LinkIDRef, + Selector: mg.Spec.ForProvider.LinkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LinkID") } @@ -625,37 +918,56 @@ func (mg *LinkAssociation) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this Site. func (mg *Site) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, - Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.GlobalNetworkIDRef, + Selector: mg.Spec.InitProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GlobalNetworkID") } @@ -667,69 +979,105 @@ func (mg *Site) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this TransitGatewayConnectPeerAssociation. func (mg *TransitGatewayConnectPeerAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DeviceIDRef, - Selector: mg.Spec.ForProvider.DeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DeviceIDRef, + Selector: mg.Spec.ForProvider.DeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeviceID") } mg.Spec.ForProvider.DeviceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeviceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayConnectPeerArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TransitGatewayConnectPeerArnRef, - Selector: mg.Spec.ForProvider.TransitGatewayConnectPeerArnSelector, - To: reference.To{ - List: &v1beta1.TransitGatewayConnectPeerList{}, - Managed: &v1beta1.TransitGatewayConnectPeer{}, - }, - }) + "TransitGatewayConnectPeer", + + "TransitGatewayConnectPeerList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayConnectPeerArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TransitGatewayConnectPeerArnRef, + Selector: mg.Spec.ForProvider.TransitGatewayConnectPeerArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayConnectPeerArn") } mg.Spec.ForProvider.TransitGatewayConnectPeerArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TransitGatewayConnectPeerArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeviceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DeviceIDRef, - Selector: mg.Spec.InitProvider.DeviceIDSelector, - To: reference.To{ - List: &DeviceList{}, - Managed: &Device{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "Device", + + "DeviceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeviceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DeviceIDRef, + Selector: mg.Spec.InitProvider.DeviceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DeviceID") } @@ -741,37 +1089,58 @@ func (mg *TransitGatewayConnectPeerAssociation) ResolveReferences(ctx context.Co // ResolveReferences of this TransitGatewayRegistration. func (mg *TransitGatewayRegistration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, - Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, - To: reference.To{ - List: &GlobalNetworkList{}, - Managed: &GlobalNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "GlobalNetwork", + + "GlobalNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GlobalNetworkID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.GlobalNetworkIDRef, + Selector: mg.Spec.ForProvider.GlobalNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GlobalNetworkID") } mg.Spec.ForProvider.GlobalNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.GlobalNetworkIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TransitGatewayArnRef, - Selector: mg.Spec.ForProvider.TransitGatewayArnSelector, - To: reference.To{ - List: &v1beta1.TransitGatewayList{}, - Managed: &v1beta1.TransitGateway{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "TransitGateway", + + "TransitGatewayList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TransitGatewayArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TransitGatewayArnRef, + Selector: mg.Spec.ForProvider.TransitGatewayArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TransitGatewayArn") } @@ -783,102 +1152,155 @@ func (mg *TransitGatewayRegistration) ResolveReferences(ctx context.Context, c c // ResolveReferences of this VPCAttachment. func (mg *VPCAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CoreNetworkID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CoreNetworkIDRef, - Selector: mg.Spec.ForProvider.CoreNetworkIDSelector, - To: reference.To{ - List: &CoreNetworkList{}, - Managed: &CoreNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "CoreNetwork", + + "CoreNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CoreNetworkID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CoreNetworkIDRef, + Selector: mg.Spec.ForProvider.CoreNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CoreNetworkID") } mg.Spec.ForProvider.CoreNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CoreNetworkIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetArns), - Extract: common.ARNExtractor(), - References: mg.Spec.ForProvider.SubnetArnsRefs, - Selector: mg.Spec.ForProvider.SubnetArnsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetArns), + Extract: common.ARNExtractor(), + References: mg.Spec.ForProvider.SubnetArnsRefs, + Selector: mg.Spec.ForProvider.SubnetArnsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetArns") } mg.Spec.ForProvider.SubnetArns = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetArnsRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.VPCArnRef, - Selector: mg.Spec.ForProvider.VPCArnSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.VPCArnRef, + Selector: mg.Spec.ForProvider.VPCArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCArn") } mg.Spec.ForProvider.VPCArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CoreNetworkID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CoreNetworkIDRef, - Selector: mg.Spec.InitProvider.CoreNetworkIDSelector, - To: reference.To{ - List: &CoreNetworkList{}, - Managed: &CoreNetwork{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("networkmanager.aws.upbound.io", + + "v1beta1", + "CoreNetwork", + + "CoreNetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CoreNetworkID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CoreNetworkIDRef, + Selector: mg.Spec.InitProvider.CoreNetworkIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CoreNetworkID") } mg.Spec.InitProvider.CoreNetworkID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CoreNetworkIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetArns), - Extract: common.ARNExtractor(), - References: mg.Spec.InitProvider.SubnetArnsRefs, - Selector: mg.Spec.InitProvider.SubnetArnsSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetArns), + Extract: common.ARNExtractor(), + References: mg.Spec.InitProvider.SubnetArnsRefs, + Selector: mg.Spec.InitProvider.SubnetArnsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetArns") } mg.Spec.InitProvider.SubnetArns = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SubnetArnsRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.VPCArnRef, - Selector: mg.Spec.InitProvider.VPCArnSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.VPCArnRef, + Selector: mg.Spec.InitProvider.VPCArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCArn") } diff --git a/apis/opensearch/v1beta1/zz_generated.resolvers.go b/apis/opensearch/v1beta1/zz_generated.resolvers.go index feeda12221..3a76b82e45 100644 --- a/apis/opensearch/v1beta1/zz_generated.resolvers.go +++ b/apis/opensearch/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" + + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Domain. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this Domain. func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.LogPublishingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnRef, - Selector: mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnSelector, - To: reference.To{ - List: &v1beta1.GroupList{}, - Managed: &v1beta1.Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnRef, + Selector: mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn") } @@ -40,16 +56,26 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.LogPublishingOptions); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnRef, - Selector: mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnSelector, - To: reference.To{ - List: &v1beta1.GroupList{}, - Managed: &v1beta1.Group{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatchlogs.aws.upbound.io", + + "v1beta1", + "Group", + + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnRef, + Selector: mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LogPublishingOptions[i3].CloudwatchLogGroupArn") } @@ -63,37 +89,58 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this DomainPolicy. func (mg *DomainPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("opensearch.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DomainNameRef, - Selector: mg.Spec.ForProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DomainNameRef, + Selector: mg.Spec.ForProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainName") } mg.Spec.ForProvider.DomainName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opensearch.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DomainNameRef, - Selector: mg.Spec.InitProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DomainNameRef, + Selector: mg.Spec.InitProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainName") } @@ -105,37 +152,58 @@ func (mg *DomainPolicy) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this DomainSAMLOptions. func (mg *DomainSAMLOptions) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("opensearch.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), - Extract: resource.ExtractParamPath("domain_name", false), - Reference: mg.Spec.ForProvider.DomainNameRef, - Selector: mg.Spec.ForProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainName), + Extract: resource.ExtractParamPath("domain_name", false), + Reference: mg.Spec.ForProvider.DomainNameRef, + Selector: mg.Spec.ForProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainName") } mg.Spec.ForProvider.DomainName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opensearch.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), - Extract: resource.ExtractParamPath("domain_name", false), - Reference: mg.Spec.InitProvider.DomainNameRef, - Selector: mg.Spec.InitProvider.DomainNameSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainName), + Extract: resource.ExtractParamPath("domain_name", false), + Reference: mg.Spec.InitProvider.DomainNameRef, + Selector: mg.Spec.InitProvider.DomainNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainName") } diff --git a/apis/opsworks/v1beta1/zz_generated.resolvers.go b/apis/opsworks/v1beta1/zz_generated.resolvers.go index 4cd6b38037..0bc9fcbb13 100644 --- a/apis/opsworks/v1beta1/zz_generated.resolvers.go +++ b/apis/opsworks/v1beta1/zz_generated.resolvers.go @@ -10,47 +10,68 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/ecs/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/rds/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Application. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Application. func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -62,70 +83,109 @@ func (mg *Application) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this CustomLayer. func (mg *CustomLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -137,102 +197,159 @@ func (mg *CustomLayer) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this EcsClusterLayer. func (mg *EcsClusterLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EcsClusterArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.EcsClusterArnRef, - Selector: mg.Spec.ForProvider.EcsClusterArnSelector, - To: reference.To{ - List: &v1beta11.ClusterList{}, - Managed: &v1beta11.Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EcsClusterArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.EcsClusterArnRef, + Selector: mg.Spec.ForProvider.EcsClusterArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EcsClusterArn") } mg.Spec.ForProvider.EcsClusterArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EcsClusterArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ecs.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EcsClusterArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.EcsClusterArnRef, - Selector: mg.Spec.InitProvider.EcsClusterArnSelector, - To: reference.To{ - List: &v1beta11.ClusterList{}, - Managed: &v1beta11.Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EcsClusterArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.EcsClusterArnRef, + Selector: mg.Spec.InitProvider.EcsClusterArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EcsClusterArn") } mg.Spec.InitProvider.EcsClusterArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.EcsClusterArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -244,70 +361,109 @@ func (mg *EcsClusterLayer) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this GangliaLayer. func (mg *GangliaLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -319,70 +475,109 @@ func (mg *GangliaLayer) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this HAProxyLayer. func (mg *HAProxyLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -394,134 +589,211 @@ func (mg *HAProxyLayer) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Instance. func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "CustomLayer", + + "CustomLayerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.LayerIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.LayerIdsRefs, - Selector: mg.Spec.ForProvider.LayerIdsSelector, - To: reference.To{ - List: &CustomLayerList{}, - Managed: &CustomLayer{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.LayerIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.LayerIdsRefs, + Selector: mg.Spec.ForProvider.LayerIdsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LayerIds") } mg.Spec.ForProvider.LayerIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.LayerIdsRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "CustomLayer", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.LayerIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.LayerIdsRefs, - Selector: mg.Spec.InitProvider.LayerIdsSelector, - To: reference.To{ - List: &CustomLayerList{}, - Managed: &CustomLayer{}, - }, - }) + "CustomLayerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.LayerIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.LayerIdsRefs, + Selector: mg.Spec.InitProvider.LayerIdsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LayerIds") } mg.Spec.InitProvider.LayerIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.LayerIdsRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } mg.Spec.InitProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } @@ -533,70 +805,109 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this JavaAppLayer. func (mg *JavaAppLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -608,70 +919,109 @@ func (mg *JavaAppLayer) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this MemcachedLayer. func (mg *MemcachedLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -683,70 +1033,109 @@ func (mg *MemcachedLayer) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this MySQLLayer. func (mg *MySQLLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -758,70 +1147,109 @@ func (mg *MySQLLayer) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this NodeJSAppLayer. func (mg *NodeJSAppLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -833,70 +1261,109 @@ func (mg *NodeJSAppLayer) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this PHPAppLayer. func (mg *PHPAppLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -908,69 +1375,110 @@ func (mg *PHPAppLayer) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Permission. func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.UserArnRef, - Selector: mg.Spec.ForProvider.UserArnSelector, - To: reference.To{ - List: &v1beta12.UserList{}, - Managed: &v1beta12.User{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.UserArnRef, + Selector: mg.Spec.ForProvider.UserArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserArn") } mg.Spec.ForProvider.UserArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } mg.Spec.InitProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.UserArnRef, - Selector: mg.Spec.InitProvider.UserArnSelector, - To: reference.To{ - List: &v1beta12.UserList{}, - Managed: &v1beta12.User{}, - }, - }) + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.UserArnRef, + Selector: mg.Spec.InitProvider.UserArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserArn") } @@ -982,69 +1490,108 @@ func (mg *Permission) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this RDSDBInstance. func (mg *RDSDBInstance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RDSDBInstanceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RDSDBInstanceArnRef, - Selector: mg.Spec.ForProvider.RDSDBInstanceArnSelector, - To: reference.To{ - List: &v1beta13.InstanceList{}, - Managed: &v1beta13.Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RDSDBInstanceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RDSDBInstanceArnRef, + Selector: mg.Spec.ForProvider.RDSDBInstanceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RDSDBInstanceArn") } mg.Spec.ForProvider.RDSDBInstanceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RDSDBInstanceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RDSDBInstanceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RDSDBInstanceArnRef, - Selector: mg.Spec.InitProvider.RDSDBInstanceArnSelector, - To: reference.To{ - List: &v1beta13.InstanceList{}, - Managed: &v1beta13.Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RDSDBInstanceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RDSDBInstanceArnRef, + Selector: mg.Spec.InitProvider.RDSDBInstanceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RDSDBInstanceArn") } mg.Spec.InitProvider.RDSDBInstanceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RDSDBInstanceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -1056,70 +1603,109 @@ func (mg *RDSDBInstance) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this RailsAppLayer. func (mg *RailsAppLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "v1beta1", + + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -1131,133 +1717,210 @@ func (mg *RailsAppLayer) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Stack. func (mg *Stack) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultInstanceProfileArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.DefaultInstanceProfileArnRef, - Selector: mg.Spec.ForProvider.DefaultInstanceProfileArnSelector, - To: reference.To{ - List: &v1beta12.InstanceProfileList{}, - Managed: &v1beta12.InstanceProfile{}, - }, - }) + "v1beta1", + + "InstanceProfile", + + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultInstanceProfileArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.DefaultInstanceProfileArnRef, + Selector: mg.Spec.ForProvider.DefaultInstanceProfileArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultInstanceProfileArn") } mg.Spec.ForProvider.DefaultInstanceProfileArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DefaultInstanceProfileArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultSubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DefaultSubnetIDRef, - Selector: mg.Spec.ForProvider.DefaultSubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultSubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DefaultSubnetIDRef, + Selector: mg.Spec.ForProvider.DefaultSubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultSubnetID") } mg.Spec.ForProvider.DefaultSubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DefaultSubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceRoleArnRef, - Selector: mg.Spec.ForProvider.ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceRoleArnRef, + Selector: mg.Spec.ForProvider.ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceRoleArn") } mg.Spec.ForProvider.ServiceRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServiceRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "InstanceProfile", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultInstanceProfileArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.DefaultInstanceProfileArnRef, - Selector: mg.Spec.InitProvider.DefaultInstanceProfileArnSelector, - To: reference.To{ - List: &v1beta12.InstanceProfileList{}, - Managed: &v1beta12.InstanceProfile{}, - }, - }) + "InstanceProfileList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultInstanceProfileArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.DefaultInstanceProfileArnRef, + Selector: mg.Spec.InitProvider.DefaultInstanceProfileArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultInstanceProfileArn") } mg.Spec.InitProvider.DefaultInstanceProfileArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DefaultInstanceProfileArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultSubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DefaultSubnetIDRef, - Selector: mg.Spec.InitProvider.DefaultSubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultSubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DefaultSubnetIDRef, + Selector: mg.Spec.InitProvider.DefaultSubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultSubnetID") } mg.Spec.InitProvider.DefaultSubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DefaultSubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceRoleArnRef, - Selector: mg.Spec.InitProvider.ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceRoleArnRef, + Selector: mg.Spec.InitProvider.ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceRoleArn") } mg.Spec.InitProvider.ServiceRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ServiceRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -1269,70 +1932,109 @@ func (mg *Stack) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this StaticWebLayer. func (mg *StaticWebLayer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomSecurityGroupIds") } mg.Spec.ForProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.StackIDRef, - Selector: mg.Spec.ForProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.StackIDRef, + Selector: mg.Spec.ForProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StackID") } mg.Spec.ForProvider.StackID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StackIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.CustomSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.CustomSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomSecurityGroupIds") } mg.Spec.InitProvider.CustomSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.CustomSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("opsworks.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.StackIDRef, - Selector: mg.Spec.InitProvider.StackIDSelector, - To: reference.To{ - List: &StackList{}, - Managed: &Stack{}, - }, - }) + "Stack", + "StackList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StackID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StackIDRef, + Selector: mg.Spec.InitProvider.StackIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StackID") } @@ -1344,37 +2046,60 @@ func (mg *StaticWebLayer) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this UserProfile. func (mg *UserProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.UserArnRef, - Selector: mg.Spec.ForProvider.UserArnSelector, - To: reference.To{ - List: &v1beta12.UserList{}, - Managed: &v1beta12.User{}, - }, - }) + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.UserArnRef, + Selector: mg.Spec.ForProvider.UserArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserArn") } mg.Spec.ForProvider.UserArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.UserArnRef, - Selector: mg.Spec.InitProvider.UserArnSelector, - To: reference.To{ - List: &v1beta12.UserList{}, - Managed: &v1beta12.User{}, - }, - }) + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.UserArnRef, + Selector: mg.Spec.InitProvider.UserArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserArn") } diff --git a/apis/organizations/v1beta1/zz_generated.resolvers.go b/apis/organizations/v1beta1/zz_generated.resolvers.go index 6ef5f9ced8..0c9cf41e3c 100644 --- a/apis/organizations/v1beta1/zz_generated.resolvers.go +++ b/apis/organizations/v1beta1/zz_generated.resolvers.go @@ -8,44 +8,66 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this DelegatedAdministrator. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this DelegatedAdministrator. func (mg *DelegatedAdministrator) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("organizations.aws.upbound.io", + + "v1beta1", + "Account", + + "AccountList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AccountID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AccountIDRef, - Selector: mg.Spec.ForProvider.AccountIDSelector, - To: reference.To{ - List: &AccountList{}, - Managed: &Account{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AccountID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AccountIDRef, + Selector: mg.Spec.ForProvider.AccountIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AccountID") } mg.Spec.ForProvider.AccountID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AccountIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("organizations.aws.upbound.io", + + "v1beta1", + "Account", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AccountID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.AccountIDRef, - Selector: mg.Spec.InitProvider.AccountIDSelector, - To: reference.To{ - List: &AccountList{}, - Managed: &Account{}, - }, - }) + "AccountList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AccountID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.AccountIDRef, + Selector: mg.Spec.InitProvider.AccountIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AccountID") } @@ -57,37 +79,58 @@ func (mg *DelegatedAdministrator) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this PolicyAttachment. func (mg *PolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("organizations.aws.upbound.io", + + "v1beta1", + "Policy", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PolicyIDRef, - Selector: mg.Spec.ForProvider.PolicyIDSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PolicyIDRef, + Selector: mg.Spec.ForProvider.PolicyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PolicyID") } mg.Spec.ForProvider.PolicyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PolicyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("organizations.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PolicyIDRef, - Selector: mg.Spec.InitProvider.PolicyIDSelector, - To: reference.To{ - List: &PolicyList{}, - Managed: &Policy{}, - }, - }) + "v1beta1", + "Policy", + + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PolicyID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PolicyIDRef, + Selector: mg.Spec.InitProvider.PolicyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PolicyID") } diff --git a/apis/pinpoint/v1beta1/zz_generated.resolvers.go b/apis/pinpoint/v1beta1/zz_generated.resolvers.go index 20d1869f9f..c0f795a8d3 100644 --- a/apis/pinpoint/v1beta1/zz_generated.resolvers.go +++ b/apis/pinpoint/v1beta1/zz_generated.resolvers.go @@ -8,44 +8,68 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this SMSChannel. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this SMSChannel. func (mg *SMSChannel) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("pinpoint.aws.upbound.io", + + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), - Extract: resource.ExtractParamPath("application_id", true), - Reference: mg.Spec.ForProvider.ApplicationIDRef, - Selector: mg.Spec.ForProvider.ApplicationIDSelector, - To: reference.To{ - List: &AppList{}, - Managed: &App{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationID), + Extract: resource.ExtractParamPath("application_id", true), + Reference: mg.Spec.ForProvider.ApplicationIDRef, + Selector: mg.Spec.ForProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationID") } mg.Spec.ForProvider.ApplicationID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApplicationIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("pinpoint.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), - Extract: resource.ExtractParamPath("application_id", true), - Reference: mg.Spec.InitProvider.ApplicationIDRef, - Selector: mg.Spec.InitProvider.ApplicationIDSelector, - To: reference.To{ - List: &AppList{}, - Managed: &App{}, - }, - }) + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationID), + Extract: resource.ExtractParamPath("application_id", true), + Reference: mg.Spec.InitProvider.ApplicationIDRef, + Selector: mg.Spec.InitProvider.ApplicationIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationID") } diff --git a/apis/qldb/v1beta1/zz_generated.resolvers.go b/apis/qldb/v1beta1/zz_generated.resolvers.go index a44e9d10cc..7af0b1cf7c 100644 --- a/apis/qldb/v1beta1/zz_generated.resolvers.go +++ b/apis/qldb/v1beta1/zz_generated.resolvers.go @@ -9,46 +9,66 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Ledger. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Ledger. func (mg *Ledger) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKey), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyRef, - Selector: mg.Spec.ForProvider.KMSKeySelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKey), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyRef, + Selector: mg.Spec.ForProvider.KMSKeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKey") } mg.Spec.ForProvider.KMSKey = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKey), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyRef, - Selector: mg.Spec.InitProvider.KMSKeySelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKey), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyRef, + Selector: mg.Spec.InitProvider.KMSKeySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKey") } @@ -60,22 +80,35 @@ func (mg *Ledger) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Stream. func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.KinesisConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KinesisConfiguration[i3].StreamArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.KinesisConfiguration[i3].StreamArnRef, - Selector: mg.Spec.ForProvider.KinesisConfiguration[i3].StreamArnSelector, - To: reference.To{ - List: &v1beta11.StreamList{}, - Managed: &v1beta11.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KinesisConfiguration[i3].StreamArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.KinesisConfiguration[i3].StreamArnRef, + Selector: mg.Spec.ForProvider.KinesisConfiguration[i3].StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KinesisConfiguration[i3].StreamArn") } @@ -83,32 +116,52 @@ func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.KinesisConfiguration[i3].StreamArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LedgerName), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.LedgerNameRef, - Selector: mg.Spec.ForProvider.LedgerNameSelector, - To: reference.To{ - List: &LedgerList{}, - Managed: &Ledger{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("qldb.aws.upbound.io", + + "v1beta1", + + "Ledger", + "LedgerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LedgerName), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.LedgerNameRef, + Selector: mg.Spec.ForProvider.LedgerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LedgerName") } mg.Spec.ForProvider.LedgerName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LedgerNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } @@ -116,16 +169,26 @@ func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.KinesisConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KinesisConfiguration[i3].StreamArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.KinesisConfiguration[i3].StreamArnRef, - Selector: mg.Spec.InitProvider.KinesisConfiguration[i3].StreamArnSelector, - To: reference.To{ - List: &v1beta11.StreamList{}, - Managed: &v1beta11.Stream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kinesis.aws.upbound.io", + + "v1beta1", + + "Stream", + "StreamList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KinesisConfiguration[i3].StreamArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.KinesisConfiguration[i3].StreamArnRef, + Selector: mg.Spec.InitProvider.KinesisConfiguration[i3].StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KinesisConfiguration[i3].StreamArn") } @@ -133,32 +196,52 @@ func (mg *Stream) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.KinesisConfiguration[i3].StreamArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LedgerName), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.LedgerNameRef, - Selector: mg.Spec.InitProvider.LedgerNameSelector, - To: reference.To{ - List: &LedgerList{}, - Managed: &Ledger{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("qldb.aws.upbound.io", + + "v1beta1", + + "Ledger", + "LedgerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LedgerName), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.LedgerNameRef, + Selector: mg.Spec.InitProvider.LedgerNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LedgerName") } mg.Spec.InitProvider.LedgerName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.LedgerNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/ram/v1beta1/zz_generated.resolvers.go b/apis/ram/v1beta1/zz_generated.resolvers.go index c591215f43..7f4a51ac24 100644 --- a/apis/ram/v1beta1/zz_generated.resolvers.go +++ b/apis/ram/v1beta1/zz_generated.resolvers.go @@ -10,75 +10,115 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/organizations/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this PrincipalAssociation. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this PrincipalAssociation. func (mg *PrincipalAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Principal), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.PrincipalRef, - Selector: mg.Spec.ForProvider.PrincipalSelector, - To: reference.To{ - List: &v1beta1.OrganizationList{}, - Managed: &v1beta1.Organization{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("organizations.aws.upbound.io", + + "v1beta1", + "Organization", + + "OrganizationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Principal), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.PrincipalRef, + Selector: mg.Spec.ForProvider.PrincipalSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Principal") } mg.Spec.ForProvider.Principal = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrincipalRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceShareArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceShareArnRef, - Selector: mg.Spec.ForProvider.ResourceShareArnSelector, - To: reference.To{ - List: &ResourceShareList{}, - Managed: &ResourceShare{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ram.aws.upbound.io", + + "v1beta1", + + "ResourceShare", + "ResourceShareList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceShareArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceShareArnRef, + Selector: mg.Spec.ForProvider.ResourceShareArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceShareArn") } mg.Spec.ForProvider.ResourceShareArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceShareArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Principal), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.PrincipalRef, - Selector: mg.Spec.InitProvider.PrincipalSelector, - To: reference.To{ - List: &v1beta1.OrganizationList{}, - Managed: &v1beta1.Organization{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("organizations.aws.upbound.io", + + "v1beta1", + "Organization", + + "OrganizationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Principal), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.PrincipalRef, + Selector: mg.Spec.InitProvider.PrincipalSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Principal") } mg.Spec.InitProvider.Principal = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PrincipalRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceShareArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceShareArnRef, - Selector: mg.Spec.InitProvider.ResourceShareArnSelector, - To: reference.To{ - List: &ResourceShareList{}, - Managed: &ResourceShare{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ram.aws.upbound.io", + + "v1beta1", + + "ResourceShare", + "ResourceShareList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceShareArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceShareArnRef, + Selector: mg.Spec.InitProvider.ResourceShareArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceShareArn") } @@ -90,37 +130,58 @@ func (mg *PrincipalAssociation) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this ResourceAssociation. func (mg *ResourceAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceShareArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceShareArnRef, - Selector: mg.Spec.ForProvider.ResourceShareArnSelector, - To: reference.To{ - List: &ResourceShareList{}, - Managed: &ResourceShare{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ram.aws.upbound.io", + + "v1beta1", + + "ResourceShare", + "ResourceShareList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceShareArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceShareArnRef, + Selector: mg.Spec.ForProvider.ResourceShareArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceShareArn") } mg.Spec.ForProvider.ResourceShareArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceShareArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceShareArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceShareArnRef, - Selector: mg.Spec.InitProvider.ResourceShareArnSelector, - To: reference.To{ - List: &ResourceShareList{}, - Managed: &ResourceShare{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ram.aws.upbound.io", + + "v1beta1", + + "ResourceShare", + "ResourceShareList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceShareArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceShareArnRef, + Selector: mg.Spec.InitProvider.ResourceShareArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceShareArn") } @@ -132,37 +193,58 @@ func (mg *ResourceAssociation) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this ResourceShareAccepter. func (mg *ResourceShareAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ram.aws.upbound.io", + + "v1beta1", + + "PrincipalAssociation", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ShareArn), - Extract: resource.ExtractParamPath("resource_share_arn", false), - Reference: mg.Spec.ForProvider.ShareArnRef, - Selector: mg.Spec.ForProvider.ShareArnSelector, - To: reference.To{ - List: &PrincipalAssociationList{}, - Managed: &PrincipalAssociation{}, - }, - }) + "PrincipalAssociationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ShareArn), + Extract: resource.ExtractParamPath("resource_share_arn", false), + Reference: mg.Spec.ForProvider.ShareArnRef, + Selector: mg.Spec.ForProvider.ShareArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ShareArn") } mg.Spec.ForProvider.ShareArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ShareArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ram.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ShareArn), - Extract: resource.ExtractParamPath("resource_share_arn", false), - Reference: mg.Spec.InitProvider.ShareArnRef, - Selector: mg.Spec.InitProvider.ShareArnSelector, - To: reference.To{ - List: &PrincipalAssociationList{}, - Managed: &PrincipalAssociation{}, - }, - }) + "PrincipalAssociation", + + "PrincipalAssociationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ShareArn), + Extract: resource.ExtractParamPath("resource_share_arn", false), + Reference: mg.Spec.InitProvider.ShareArnRef, + Selector: mg.Spec.InitProvider.ShareArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ShareArn") } diff --git a/apis/rds/v1beta1/zz_generated.resolvers.go b/apis/rds/v1beta1/zz_generated.resolvers.go index b169ae769c..4f99fb7432 100644 --- a/apis/rds/v1beta1/zz_generated.resolvers.go +++ b/apis/rds/v1beta1/zz_generated.resolvers.go @@ -10,66 +10,92 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/s3/v1beta1" - v1beta15 "github.com/upbound/provider-aws/apis/secretsmanager/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Cluster. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DBSubnetGroupNameRef, - Selector: mg.Spec.ForProvider.DBSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + "v1beta1", + + "SubnetGroup", + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DBSubnetGroupNameRef, + Selector: mg.Spec.ForProvider.DBSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBSubnetGroupName") } mg.Spec.ForProvider.DBSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBSubnetGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MasterUserSecretKMSKeyID), - Extract: resource.ExtractParamPath("key_id", true), - Reference: mg.Spec.ForProvider.MasterUserSecretKMSKeyIDRef, - Selector: mg.Spec.ForProvider.MasterUserSecretKMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MasterUserSecretKMSKeyID), + Extract: resource.ExtractParamPath("key_id", true), + Reference: mg.Spec.ForProvider.MasterUserSecretKMSKeyIDRef, + Selector: mg.Spec.ForProvider.MasterUserSecretKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MasterUserSecretKMSKeyID") } @@ -77,16 +103,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.MasterUserSecretKMSKeyIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.RestoreToPointInTime); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestoreToPointInTime[i3].SourceClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RestoreToPointInTime[i3].SourceClusterIdentifierRef, - Selector: mg.Spec.ForProvider.RestoreToPointInTime[i3].SourceClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RestoreToPointInTime[i3].SourceClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RestoreToPointInTime[i3].SourceClusterIdentifierRef, + Selector: mg.Spec.ForProvider.RestoreToPointInTime[i3].SourceClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RestoreToPointInTime[i3].SourceClusterIdentifier") } @@ -95,16 +131,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.S3Import); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Import[i3].BucketName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.S3Import[i3].BucketNameRef, - Selector: mg.Spec.ForProvider.S3Import[i3].BucketNameSelector, - To: reference.To{ - List: &v1beta11.BucketList{}, - Managed: &v1beta11.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Import[i3].BucketName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.S3Import[i3].BucketNameRef, + Selector: mg.Spec.ForProvider.S3Import[i3].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3Import[i3].BucketName") } @@ -112,64 +158,99 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.S3Import[i3].BucketNameRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DBSubnetGroupNameRef, - Selector: mg.Spec.InitProvider.DBSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DBSubnetGroupNameRef, + Selector: mg.Spec.InitProvider.DBSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBSubnetGroupName") } mg.Spec.InitProvider.DBSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DBSubnetGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MasterUserSecretKMSKeyID), - Extract: resource.ExtractParamPath("key_id", true), - Reference: mg.Spec.InitProvider.MasterUserSecretKMSKeyIDRef, - Selector: mg.Spec.InitProvider.MasterUserSecretKMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MasterUserSecretKMSKeyID), + Extract: resource.ExtractParamPath("key_id", true), + Reference: mg.Spec.InitProvider.MasterUserSecretKMSKeyIDRef, + Selector: mg.Spec.InitProvider.MasterUserSecretKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MasterUserSecretKMSKeyID") } @@ -177,16 +258,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.MasterUserSecretKMSKeyIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.RestoreToPointInTime); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestoreToPointInTime[i3].SourceClusterIdentifier), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RestoreToPointInTime[i3].SourceClusterIdentifierRef, - Selector: mg.Spec.InitProvider.RestoreToPointInTime[i3].SourceClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RestoreToPointInTime[i3].SourceClusterIdentifier), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RestoreToPointInTime[i3].SourceClusterIdentifierRef, + Selector: mg.Spec.InitProvider.RestoreToPointInTime[i3].SourceClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RestoreToPointInTime[i3].SourceClusterIdentifier") } @@ -195,16 +286,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.S3Import); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Import[i3].BucketName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.S3Import[i3].BucketNameRef, - Selector: mg.Spec.InitProvider.S3Import[i3].BucketNameSelector, - To: reference.To{ - List: &v1beta11.BucketList{}, - Managed: &v1beta11.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Import[i3].BucketName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.S3Import[i3].BucketNameRef, + Selector: mg.Spec.InitProvider.S3Import[i3].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.S3Import[i3].BucketName") } @@ -212,16 +313,26 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.S3Import[i3].BucketNameRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -233,69 +344,106 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ClusterActivityStream. func (mg *ClusterActivityStream) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceArnRef, - Selector: mg.Spec.ForProvider.ResourceArnSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceArnRef, + Selector: mg.Spec.ForProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceArn") } mg.Spec.ForProvider.ResourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceArnRef, - Selector: mg.Spec.InitProvider.ResourceArnSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceArnRef, + Selector: mg.Spec.InitProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceArn") } @@ -307,37 +455,58 @@ func (mg *ClusterActivityStream) ResolveReferences(ctx context.Context, c client // ResolveReferences of this ClusterEndpoint. func (mg *ClusterEndpoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ClusterIdentifierRef, - Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ClusterIdentifierRef, + Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterIdentifier") } mg.Spec.ForProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ClusterIdentifierRef, - Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ClusterIdentifierRef, + Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterIdentifier") } @@ -349,133 +518,208 @@ func (mg *ClusterEndpoint) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this ClusterInstance. func (mg *ClusterInstance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ClusterIdentifierRef, - Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ClusterIdentifierRef, + Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterIdentifier") } mg.Spec.ForProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DBSubnetGroupNameRef, - Selector: mg.Spec.ForProvider.DBSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + "v1beta1", + + "SubnetGroup", + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DBSubnetGroupNameRef, + Selector: mg.Spec.ForProvider.DBSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBSubnetGroupName") } mg.Spec.ForProvider.DBSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBSubnetGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MonitoringRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.MonitoringRoleArnRef, - Selector: mg.Spec.ForProvider.MonitoringRoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MonitoringRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.MonitoringRoleArnRef, + Selector: mg.Spec.ForProvider.MonitoringRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MonitoringRoleArn") } mg.Spec.ForProvider.MonitoringRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.MonitoringRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PerformanceInsightsKMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PerformanceInsightsKMSKeyIDRef, - Selector: mg.Spec.ForProvider.PerformanceInsightsKMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PerformanceInsightsKMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PerformanceInsightsKMSKeyIDRef, + Selector: mg.Spec.ForProvider.PerformanceInsightsKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PerformanceInsightsKMSKeyID") } mg.Spec.ForProvider.PerformanceInsightsKMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PerformanceInsightsKMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ClusterIdentifierRef, - Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ClusterIdentifierRef, + Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterIdentifier") } mg.Spec.InitProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DBSubnetGroupNameRef, - Selector: mg.Spec.InitProvider.DBSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DBSubnetGroupNameRef, + Selector: mg.Spec.InitProvider.DBSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBSubnetGroupName") } mg.Spec.InitProvider.DBSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DBSubnetGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MonitoringRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.MonitoringRoleArnRef, - Selector: mg.Spec.InitProvider.MonitoringRoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MonitoringRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.MonitoringRoleArnRef, + Selector: mg.Spec.InitProvider.MonitoringRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MonitoringRoleArn") } mg.Spec.InitProvider.MonitoringRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.MonitoringRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PerformanceInsightsKMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PerformanceInsightsKMSKeyIDRef, - Selector: mg.Spec.InitProvider.PerformanceInsightsKMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PerformanceInsightsKMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PerformanceInsightsKMSKeyIDRef, + Selector: mg.Spec.InitProvider.PerformanceInsightsKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PerformanceInsightsKMSKeyID") } @@ -487,69 +731,110 @@ func (mg *ClusterInstance) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this ClusterRoleAssociation. func (mg *ClusterRoleAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DBClusterIdentifierRef, - Selector: mg.Spec.ForProvider.DBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DBClusterIdentifierRef, + Selector: mg.Spec.ForProvider.DBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBClusterIdentifier") } mg.Spec.ForProvider.DBClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DBClusterIdentifierRef, - Selector: mg.Spec.InitProvider.DBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DBClusterIdentifierRef, + Selector: mg.Spec.InitProvider.DBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBClusterIdentifier") } mg.Spec.InitProvider.DBClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DBClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -561,37 +846,58 @@ func (mg *ClusterRoleAssociation) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this ClusterSnapshot. func (mg *ClusterSnapshot) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DBClusterIdentifierRef, - Selector: mg.Spec.ForProvider.DBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DBClusterIdentifierRef, + Selector: mg.Spec.ForProvider.DBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBClusterIdentifier") } mg.Spec.ForProvider.DBClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DBClusterIdentifierRef, - Selector: mg.Spec.InitProvider.DBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DBClusterIdentifierRef, + Selector: mg.Spec.InitProvider.DBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBClusterIdentifier") } @@ -603,69 +909,106 @@ func (mg *ClusterSnapshot) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this DBInstanceAutomatedBackupsReplication. func (mg *DBInstanceAutomatedBackupsReplication) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBInstanceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SourceDBInstanceArnRef, - Selector: mg.Spec.ForProvider.SourceDBInstanceArnSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBInstanceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SourceDBInstanceArnRef, + Selector: mg.Spec.ForProvider.SourceDBInstanceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceDBInstanceArn") } mg.Spec.ForProvider.SourceDBInstanceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceDBInstanceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBInstanceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SourceDBInstanceArnRef, - Selector: mg.Spec.InitProvider.SourceDBInstanceArnSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBInstanceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SourceDBInstanceArnRef, + Selector: mg.Spec.InitProvider.SourceDBInstanceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceDBInstanceArn") } @@ -677,69 +1020,106 @@ func (mg *DBInstanceAutomatedBackupsReplication) ResolveReferences(ctx context.C // ResolveReferences of this DBSnapshotCopy. func (mg *DBSnapshotCopy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBSnapshotIdentifier), - Extract: resource.ExtractParamPath("db_snapshot_arn", true), - Reference: mg.Spec.ForProvider.SourceDBSnapshotIdentifierRef, - Selector: mg.Spec.ForProvider.SourceDBSnapshotIdentifierSelector, - To: reference.To{ - List: &SnapshotList{}, - Managed: &Snapshot{}, - }, - }) + "Snapshot", + "SnapshotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBSnapshotIdentifier), + Extract: resource.ExtractParamPath("db_snapshot_arn", true), + Reference: mg.Spec.ForProvider.SourceDBSnapshotIdentifierRef, + Selector: mg.Spec.ForProvider.SourceDBSnapshotIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceDBSnapshotIdentifier") } mg.Spec.ForProvider.SourceDBSnapshotIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceDBSnapshotIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Snapshot", + "SnapshotList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBSnapshotIdentifier), - Extract: resource.ExtractParamPath("db_snapshot_arn", true), - Reference: mg.Spec.InitProvider.SourceDBSnapshotIdentifierRef, - Selector: mg.Spec.InitProvider.SourceDBSnapshotIdentifierSelector, - To: reference.To{ - List: &SnapshotList{}, - Managed: &Snapshot{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBSnapshotIdentifier), + Extract: resource.ExtractParamPath("db_snapshot_arn", true), + Reference: mg.Spec.InitProvider.SourceDBSnapshotIdentifierRef, + Selector: mg.Spec.InitProvider.SourceDBSnapshotIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceDBSnapshotIdentifier") } @@ -751,37 +1131,58 @@ func (mg *DBSnapshotCopy) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this EventSubscription. func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopic), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SnsTopicRef, - Selector: mg.Spec.ForProvider.SnsTopicSelector, - To: reference.To{ - List: &v1beta14.TopicList{}, - Managed: &v1beta14.Topic{}, - }, - }) + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopic), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SnsTopicRef, + Selector: mg.Spec.ForProvider.SnsTopicSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnsTopic") } mg.Spec.ForProvider.SnsTopic = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnsTopicRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopic), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SnsTopicRef, - Selector: mg.Spec.InitProvider.SnsTopicSelector, - To: reference.To{ - List: &v1beta14.TopicList{}, - Managed: &v1beta14.Topic{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopic), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SnsTopicRef, + Selector: mg.Spec.InitProvider.SnsTopicSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnsTopic") } @@ -793,37 +1194,58 @@ func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this GlobalCluster. func (mg *GlobalCluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBClusterIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SourceDBClusterIdentifierRef, - Selector: mg.Spec.ForProvider.SourceDBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceDBClusterIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SourceDBClusterIdentifierRef, + Selector: mg.Spec.ForProvider.SourceDBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceDBClusterIdentifier") } mg.Spec.ForProvider.SourceDBClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceDBClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBClusterIdentifier), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SourceDBClusterIdentifierRef, - Selector: mg.Spec.InitProvider.SourceDBClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceDBClusterIdentifier), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SourceDBClusterIdentifierRef, + Selector: mg.Spec.InitProvider.SourceDBClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceDBClusterIdentifier") } @@ -835,230 +1257,359 @@ func (mg *GlobalCluster) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Instance. func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DBSubnetGroupNameRef, - Selector: mg.Spec.ForProvider.DBSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + "v1beta1", + + "SubnetGroup", + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DBSubnetGroupNameRef, + Selector: mg.Spec.ForProvider.DBSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBSubnetGroupName") } mg.Spec.ForProvider.DBSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBSubnetGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MasterUserSecretKMSKeyID), - Extract: resource.ExtractParamPath("key_id", true), - Reference: mg.Spec.ForProvider.MasterUserSecretKMSKeyIDRef, - Selector: mg.Spec.ForProvider.MasterUserSecretKMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MasterUserSecretKMSKeyID), + Extract: resource.ExtractParamPath("key_id", true), + Reference: mg.Spec.ForProvider.MasterUserSecretKMSKeyIDRef, + Selector: mg.Spec.ForProvider.MasterUserSecretKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MasterUserSecretKMSKeyID") } mg.Spec.ForProvider.MasterUserSecretKMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.MasterUserSecretKMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MonitoringRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.MonitoringRoleArnRef, - Selector: mg.Spec.ForProvider.MonitoringRoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MonitoringRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.MonitoringRoleArnRef, + Selector: mg.Spec.ForProvider.MonitoringRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MonitoringRoleArn") } mg.Spec.ForProvider.MonitoringRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.MonitoringRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ParameterGroupNameRef, - Selector: mg.Spec.ForProvider.ParameterGroupNameSelector, - To: reference.To{ - List: &ParameterGroupList{}, - Managed: &ParameterGroup{}, - }, - }) + "ParameterGroup", + + "ParameterGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ParameterGroupNameRef, + Selector: mg.Spec.ForProvider.ParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ParameterGroupName") } mg.Spec.ForProvider.ParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ParameterGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicateSourceDB), - Extract: resource.ExtractParamPath("identifier", false), - Reference: mg.Spec.ForProvider.ReplicateSourceDBRef, - Selector: mg.Spec.ForProvider.ReplicateSourceDBSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ReplicateSourceDB), + Extract: resource.ExtractParamPath("identifier", false), + Reference: mg.Spec.ForProvider.ReplicateSourceDBRef, + Selector: mg.Spec.ForProvider.ReplicateSourceDBSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ReplicateSourceDB") } mg.Spec.ForProvider.ReplicateSourceDB = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ReplicateSourceDBRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "SubnetGroup", + "SubnetGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBSubnetGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DBSubnetGroupNameRef, - Selector: mg.Spec.InitProvider.DBSubnetGroupNameSelector, - To: reference.To{ - List: &SubnetGroupList{}, - Managed: &SubnetGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBSubnetGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DBSubnetGroupNameRef, + Selector: mg.Spec.InitProvider.DBSubnetGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBSubnetGroupName") } mg.Spec.InitProvider.DBSubnetGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DBSubnetGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MasterUserSecretKMSKeyID), - Extract: resource.ExtractParamPath("key_id", true), - Reference: mg.Spec.InitProvider.MasterUserSecretKMSKeyIDRef, - Selector: mg.Spec.InitProvider.MasterUserSecretKMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MasterUserSecretKMSKeyID), + Extract: resource.ExtractParamPath("key_id", true), + Reference: mg.Spec.InitProvider.MasterUserSecretKMSKeyIDRef, + Selector: mg.Spec.InitProvider.MasterUserSecretKMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MasterUserSecretKMSKeyID") } mg.Spec.InitProvider.MasterUserSecretKMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.MasterUserSecretKMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MonitoringRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.MonitoringRoleArnRef, - Selector: mg.Spec.InitProvider.MonitoringRoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MonitoringRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.MonitoringRoleArnRef, + Selector: mg.Spec.InitProvider.MonitoringRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MonitoringRoleArn") } mg.Spec.InitProvider.MonitoringRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.MonitoringRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "ParameterGroup", + + "ParameterGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ParameterGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ParameterGroupNameRef, - Selector: mg.Spec.InitProvider.ParameterGroupNameSelector, - To: reference.To{ - List: &ParameterGroupList{}, - Managed: &ParameterGroup{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ParameterGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ParameterGroupNameRef, + Selector: mg.Spec.InitProvider.ParameterGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ParameterGroupName") } mg.Spec.InitProvider.ParameterGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ParameterGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicateSourceDB), - Extract: resource.ExtractParamPath("identifier", false), - Reference: mg.Spec.InitProvider.ReplicateSourceDBRef, - Selector: mg.Spec.InitProvider.ReplicateSourceDBSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ReplicateSourceDB), + Extract: resource.ExtractParamPath("identifier", false), + Reference: mg.Spec.InitProvider.ReplicateSourceDBRef, + Selector: mg.Spec.InitProvider.ReplicateSourceDBSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ReplicateSourceDB") } mg.Spec.InitProvider.ReplicateSourceDB = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ReplicateSourceDBRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -1070,69 +1621,110 @@ func (mg *Instance) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this InstanceRoleAssociation. func (mg *InstanceRoleAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBInstanceIdentifier), - Extract: resource.ExtractParamPath("identifier", false), - Reference: mg.Spec.ForProvider.DBInstanceIdentifierRef, - Selector: mg.Spec.ForProvider.DBInstanceIdentifierSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBInstanceIdentifier), + Extract: resource.ExtractParamPath("identifier", false), + Reference: mg.Spec.ForProvider.DBInstanceIdentifierRef, + Selector: mg.Spec.ForProvider.DBInstanceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBInstanceIdentifier") } mg.Spec.ForProvider.DBInstanceIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBInstanceIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBInstanceIdentifier), - Extract: resource.ExtractParamPath("identifier", false), - Reference: mg.Spec.InitProvider.DBInstanceIdentifierRef, - Selector: mg.Spec.InitProvider.DBInstanceIdentifierSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBInstanceIdentifier), + Extract: resource.ExtractParamPath("identifier", false), + Reference: mg.Spec.InitProvider.DBInstanceIdentifierRef, + Selector: mg.Spec.InitProvider.DBInstanceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBInstanceIdentifier") } mg.Spec.InitProvider.DBInstanceIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DBInstanceIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -1144,6 +1736,9 @@ func (mg *InstanceRoleAssociation) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this Proxy. func (mg *Proxy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -1151,16 +1746,25 @@ func (mg *Proxy) ResolveReferences(ctx context.Context, c client.Reader) error { var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Auth); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Auth[i3].SecretArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Auth[i3].SecretArnRef, - Selector: mg.Spec.ForProvider.Auth[i3].SecretArnSelector, - To: reference.To{ - List: &v1beta15.SecretList{}, - Managed: &v1beta15.Secret{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Auth[i3].SecretArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Auth[i3].SecretArnRef, + Selector: mg.Spec.ForProvider.Auth[i3].SecretArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Auth[i3].SecretArn") } @@ -1168,32 +1772,52 @@ func (mg *Proxy) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.Auth[i3].SecretArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } @@ -1201,16 +1825,25 @@ func (mg *Proxy) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.InitProvider.Auth); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Auth[i3].SecretArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Auth[i3].SecretArnRef, - Selector: mg.Spec.InitProvider.Auth[i3].SecretArnSelector, - To: reference.To{ - List: &v1beta15.SecretList{}, - Managed: &v1beta15.Secret{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Auth[i3].SecretArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Auth[i3].SecretArnRef, + Selector: mg.Spec.InitProvider.Auth[i3].SecretArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Auth[i3].SecretArn") } @@ -1218,32 +1851,52 @@ func (mg *Proxy) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.InitProvider.Auth[i3].SecretArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } mg.Spec.InitProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -1255,37 +1908,58 @@ func (mg *Proxy) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this ProxyDefaultTargetGroup. func (mg *ProxyDefaultTargetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBProxyName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DBProxyNameRef, - Selector: mg.Spec.ForProvider.DBProxyNameSelector, - To: reference.To{ - List: &ProxyList{}, - Managed: &Proxy{}, - }, - }) + "v1beta1", + + "Proxy", + "ProxyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBProxyName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DBProxyNameRef, + Selector: mg.Spec.ForProvider.DBProxyNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBProxyName") } mg.Spec.ForProvider.DBProxyName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBProxyNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBProxyName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DBProxyNameRef, - Selector: mg.Spec.InitProvider.DBProxyNameSelector, - To: reference.To{ - List: &ProxyList{}, - Managed: &Proxy{}, - }, - }) + "v1beta1", + + "Proxy", + "ProxyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBProxyName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DBProxyNameRef, + Selector: mg.Spec.InitProvider.DBProxyNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBProxyName") } @@ -1297,54 +1971,84 @@ func (mg *ProxyDefaultTargetGroup) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this ProxyEndpoint. func (mg *ProxyEndpoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Proxy", + "ProxyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBProxyName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DBProxyNameRef, - Selector: mg.Spec.ForProvider.DBProxyNameSelector, - To: reference.To{ - List: &ProxyList{}, - Managed: &Proxy{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBProxyName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DBProxyNameRef, + Selector: mg.Spec.ForProvider.DBProxyNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBProxyName") } mg.Spec.ForProvider.DBProxyName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBProxyNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -1356,69 +2060,108 @@ func (mg *ProxyEndpoint) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this ProxyTarget. func (mg *ProxyTarget) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBInstanceIdentifier), - Extract: resource.ExtractParamPath("identifier", false), - Reference: mg.Spec.ForProvider.DBInstanceIdentifierRef, - Selector: mg.Spec.ForProvider.DBInstanceIdentifierSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBInstanceIdentifier), + Extract: resource.ExtractParamPath("identifier", false), + Reference: mg.Spec.ForProvider.DBInstanceIdentifierRef, + Selector: mg.Spec.ForProvider.DBInstanceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBInstanceIdentifier") } mg.Spec.ForProvider.DBInstanceIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBInstanceIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Proxy", + "ProxyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBProxyName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DBProxyNameRef, - Selector: mg.Spec.ForProvider.DBProxyNameSelector, - To: reference.To{ - List: &ProxyList{}, - Managed: &Proxy{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBProxyName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DBProxyNameRef, + Selector: mg.Spec.ForProvider.DBProxyNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBProxyName") } mg.Spec.ForProvider.DBProxyName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBProxyNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBInstanceIdentifier), - Extract: resource.ExtractParamPath("identifier", false), - Reference: mg.Spec.InitProvider.DBInstanceIdentifierRef, - Selector: mg.Spec.InitProvider.DBInstanceIdentifierSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBInstanceIdentifier), + Extract: resource.ExtractParamPath("identifier", false), + Reference: mg.Spec.InitProvider.DBInstanceIdentifierRef, + Selector: mg.Spec.InitProvider.DBInstanceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBInstanceIdentifier") } mg.Spec.InitProvider.DBInstanceIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DBInstanceIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Proxy", + "ProxyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBProxyName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DBProxyNameRef, - Selector: mg.Spec.InitProvider.DBProxyNameSelector, - To: reference.To{ - List: &ProxyList{}, - Managed: &Proxy{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBProxyName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DBProxyNameRef, + Selector: mg.Spec.InitProvider.DBProxyNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBProxyName") } @@ -1430,37 +2173,58 @@ func (mg *ProxyTarget) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Snapshot. func (mg *Snapshot) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBInstanceIdentifier), - Extract: resource.ExtractParamPath("identifier", false), - Reference: mg.Spec.ForProvider.DBInstanceIdentifierRef, - Selector: mg.Spec.ForProvider.DBInstanceIdentifierSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DBInstanceIdentifier), + Extract: resource.ExtractParamPath("identifier", false), + Reference: mg.Spec.ForProvider.DBInstanceIdentifierRef, + Selector: mg.Spec.ForProvider.DBInstanceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DBInstanceIdentifier") } mg.Spec.ForProvider.DBInstanceIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DBInstanceIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rds.aws.upbound.io", + + "v1beta1", + + "Instance", + "InstanceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBInstanceIdentifier), - Extract: resource.ExtractParamPath("identifier", false), - Reference: mg.Spec.InitProvider.DBInstanceIdentifierRef, - Selector: mg.Spec.InitProvider.DBInstanceIdentifierSelector, - To: reference.To{ - List: &InstanceList{}, - Managed: &Instance{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DBInstanceIdentifier), + Extract: resource.ExtractParamPath("identifier", false), + Reference: mg.Spec.InitProvider.DBInstanceIdentifierRef, + Selector: mg.Spec.InitProvider.DBInstanceIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DBInstanceIdentifier") } @@ -1472,37 +2236,58 @@ func (mg *Snapshot) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this SubnetGroup. func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/redshift/v1beta1/zz_generated.resolvers.go b/apis/redshift/v1beta1/zz_generated.resolvers.go index 2c4d1f14f7..3574868eec 100644 --- a/apis/redshift/v1beta1/zz_generated.resolvers.go +++ b/apis/redshift/v1beta1/zz_generated.resolvers.go @@ -10,144 +10,221 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Cluster. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Cluster. func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultIAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.DefaultIAMRoleArnRef, - Selector: mg.Spec.ForProvider.DefaultIAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultIAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.DefaultIAMRoleArnRef, + Selector: mg.Spec.ForProvider.DefaultIAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultIAMRoleArn") } mg.Spec.ForProvider.DefaultIAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DefaultIAMRoleArnRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.IAMRoles), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.IAMRoleRefs, - Selector: mg.Spec.ForProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.IAMRoles), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.IAMRoleRefs, + Selector: mg.Spec.ForProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoles") } mg.Spec.ForProvider.IAMRoles = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.IAMRoleRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultIAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.DefaultIAMRoleArnRef, - Selector: mg.Spec.InitProvider.DefaultIAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultIAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.DefaultIAMRoleArnRef, + Selector: mg.Spec.InitProvider.DefaultIAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultIAMRoleArn") } mg.Spec.InitProvider.DefaultIAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DefaultIAMRoleArnRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.IAMRoles), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.IAMRoleRefs, - Selector: mg.Spec.InitProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.IAMRoles), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.IAMRoleRefs, + Selector: mg.Spec.InitProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoles") } mg.Spec.InitProvider.IAMRoles = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.IAMRoleRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta12.SecurityGroupList{}, - Managed: &v1beta12.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -159,37 +236,58 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this EventSubscription. func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SnsTopicArnRef, - Selector: mg.Spec.ForProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SnsTopicArnRef, + Selector: mg.Spec.ForProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnsTopicArn") } mg.Spec.ForProvider.SnsTopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SnsTopicArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SnsTopicArnRef, - Selector: mg.Spec.InitProvider.SnsTopicArnSelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsTopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SnsTopicArnRef, + Selector: mg.Spec.InitProvider.SnsTopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnsTopicArn") } @@ -201,37 +299,60 @@ func (mg *EventSubscription) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this ScheduledAction. func (mg *ScheduledAction) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRole), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.IAMRoleRef, - Selector: mg.Spec.ForProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRole), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.IAMRoleRef, + Selector: mg.Spec.ForProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRole") } mg.Spec.ForProvider.IAMRole = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IAMRoleRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRole), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.IAMRoleRef, - Selector: mg.Spec.InitProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRole), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.IAMRoleRef, + Selector: mg.Spec.InitProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRole") } @@ -243,37 +364,56 @@ func (mg *ScheduledAction) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this SnapshotCopyGrant. func (mg *SnapshotCopyGrant) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta11.KeyList{}, - Managed: &v1beta11.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -285,69 +425,108 @@ func (mg *SnapshotCopyGrant) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this SnapshotScheduleAssociation. func (mg *SnapshotScheduleAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ClusterIdentifierRef, - Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshift.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ClusterIdentifierRef, + Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterIdentifier") } mg.Spec.ForProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("redshift.aws.upbound.io", + + "v1beta1", + + "SnapshotSchedule", + + "SnapshotScheduleList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ScheduleIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ScheduleIdentifierRef, - Selector: mg.Spec.ForProvider.ScheduleIdentifierSelector, - To: reference.To{ - List: &SnapshotScheduleList{}, - Managed: &SnapshotSchedule{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ScheduleIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ScheduleIdentifierRef, + Selector: mg.Spec.ForProvider.ScheduleIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ScheduleIdentifier") } mg.Spec.ForProvider.ScheduleIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ScheduleIdentifierRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ClusterIdentifierRef, - Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshift.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ClusterIdentifierRef, + Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterIdentifier") } mg.Spec.InitProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterIdentifierRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("redshift.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ScheduleIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ScheduleIdentifierRef, - Selector: mg.Spec.InitProvider.ScheduleIdentifierSelector, - To: reference.To{ - List: &SnapshotScheduleList{}, - Managed: &SnapshotSchedule{}, - }, - }) + "v1beta1", + + "SnapshotSchedule", + + "SnapshotScheduleList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ScheduleIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ScheduleIdentifierRef, + Selector: mg.Spec.InitProvider.ScheduleIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ScheduleIdentifier") } @@ -359,37 +538,58 @@ func (mg *SnapshotScheduleAssociation) ResolveReferences(ctx context.Context, c // ResolveReferences of this SubnetGroup. func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta12.SubnetList{}, - Managed: &v1beta12.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } @@ -401,37 +601,58 @@ func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this UsageLimit. func (mg *UsageLimit) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ClusterIdentifierRef, - Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshift.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ClusterIdentifierRef, + Selector: mg.Spec.ForProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterIdentifier") } mg.Spec.ForProvider.ClusterIdentifier = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterIdentifierRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ClusterIdentifierRef, - Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshift.aws.upbound.io", + + "v1beta1", + + "Cluster", + "ClusterList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterIdentifier), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ClusterIdentifierRef, + Selector: mg.Spec.InitProvider.ClusterIdentifierSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterIdentifier") } diff --git a/apis/redshiftserverless/v1beta1/zz_generated.resolvers.go b/apis/redshiftserverless/v1beta1/zz_generated.resolvers.go index ed1fc15d52..25bbaebfc9 100644 --- a/apis/redshiftserverless/v1beta1/zz_generated.resolvers.go +++ b/apis/redshiftserverless/v1beta1/zz_generated.resolvers.go @@ -10,78 +10,118 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this EndpointAccess. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this EndpointAccess. func (mg *EndpointAccess) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCSecurityGroupIds") } mg.Spec.ForProvider.VPCSecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.VPCSecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } mg.Spec.InitProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SubnetIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.VPCSecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.VPCSecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.VPCSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCSecurityGroupIds") } @@ -93,102 +133,161 @@ func (mg *EndpointAccess) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this RedshiftServerlessNamespace. func (mg *RedshiftServerlessNamespace) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultIAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.DefaultIAMRoleArnRef, - Selector: mg.Spec.ForProvider.DefaultIAMRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultIAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.DefaultIAMRoleArnRef, + Selector: mg.Spec.ForProvider.DefaultIAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultIAMRoleArn") } mg.Spec.ForProvider.DefaultIAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DefaultIAMRoleArnRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.IAMRoles), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.IAMRoleRefs, - Selector: mg.Spec.ForProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.IAMRoles), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.IAMRoleRefs, + Selector: mg.Spec.ForProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoles") } mg.Spec.ForProvider.IAMRoles = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.IAMRoleRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultIAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.DefaultIAMRoleArnRef, - Selector: mg.Spec.InitProvider.DefaultIAMRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultIAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.DefaultIAMRoleArnRef, + Selector: mg.Spec.InitProvider.DefaultIAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultIAMRoleArn") } mg.Spec.InitProvider.DefaultIAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DefaultIAMRoleArnRef = rsp.ResolvedReference - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.IAMRoles), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.IAMRoleRefs, - Selector: mg.Spec.InitProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.IAMRoles), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.IAMRoleRefs, + Selector: mg.Spec.InitProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoles") } mg.Spec.InitProvider.IAMRoles = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.IAMRoleRefs = mrsp.ResolvedReferences - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -200,37 +299,56 @@ func (mg *RedshiftServerlessNamespace) ResolveReferences(ctx context.Context, c // ResolveReferences of this ResourcePolicy. func (mg *ResourcePolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceArnRef, - Selector: mg.Spec.ForProvider.ResourceArnSelector, - To: reference.To{ - List: &SnapshotList{}, - Managed: &Snapshot{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshiftserverless.aws.upbound.io", + + "v1beta1", + "Snapshot", + + "SnapshotList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceArnRef, + Selector: mg.Spec.ForProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceArn") } mg.Spec.ForProvider.ResourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceArnRef, - Selector: mg.Spec.InitProvider.ResourceArnSelector, - To: reference.To{ - List: &SnapshotList{}, - Managed: &Snapshot{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshiftserverless.aws.upbound.io", + + "v1beta1", + "Snapshot", + + "SnapshotList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceArnRef, + Selector: mg.Spec.InitProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceArn") } @@ -242,37 +360,56 @@ func (mg *ResourcePolicy) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this Snapshot. func (mg *Snapshot) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NamespaceName), - Extract: resource.ExtractParamPath("namespace_name", false), - Reference: mg.Spec.ForProvider.NamespaceNameRef, - Selector: mg.Spec.ForProvider.NamespaceNameSelector, - To: reference.To{ - List: &WorkgroupList{}, - Managed: &Workgroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshiftserverless.aws.upbound.io", + + "v1beta1", + "Workgroup", + + "WorkgroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.NamespaceName), + Extract: resource.ExtractParamPath("namespace_name", false), + Reference: mg.Spec.ForProvider.NamespaceNameRef, + Selector: mg.Spec.ForProvider.NamespaceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.NamespaceName") } mg.Spec.ForProvider.NamespaceName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NamespaceNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NamespaceName), - Extract: resource.ExtractParamPath("namespace_name", false), - Reference: mg.Spec.InitProvider.NamespaceNameRef, - Selector: mg.Spec.InitProvider.NamespaceNameSelector, - To: reference.To{ - List: &WorkgroupList{}, - Managed: &Workgroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshiftserverless.aws.upbound.io", + + "v1beta1", + "Workgroup", + + "WorkgroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.NamespaceName), + Extract: resource.ExtractParamPath("namespace_name", false), + Reference: mg.Spec.InitProvider.NamespaceNameRef, + Selector: mg.Spec.InitProvider.NamespaceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.NamespaceName") } @@ -284,37 +421,56 @@ func (mg *Snapshot) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this UsageLimit. func (mg *UsageLimit) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceArnRef, - Selector: mg.Spec.ForProvider.ResourceArnSelector, - To: reference.To{ - List: &WorkgroupList{}, - Managed: &Workgroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshiftserverless.aws.upbound.io", + + "v1beta1", + "Workgroup", + + "WorkgroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceArnRef, + Selector: mg.Spec.ForProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceArn") } mg.Spec.ForProvider.ResourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceArnRef, - Selector: mg.Spec.InitProvider.ResourceArnSelector, - To: reference.To{ - List: &WorkgroupList{}, - Managed: &Workgroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("redshiftserverless.aws.upbound.io", + + "v1beta1", + "Workgroup", + + "WorkgroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceArnRef, + Selector: mg.Spec.InitProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceArn") } @@ -326,69 +482,108 @@ func (mg *UsageLimit) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Workgroup. func (mg *Workgroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences - - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } diff --git a/apis/rolesanywhere/v1beta1/zz_generated.resolvers.go b/apis/rolesanywhere/v1beta1/zz_generated.resolvers.go index 286564553c..9392dee237 100644 --- a/apis/rolesanywhere/v1beta1/zz_generated.resolvers.go +++ b/apis/rolesanywhere/v1beta1/zz_generated.resolvers.go @@ -9,44 +9,70 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Profile. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Profile. func (mg *Profile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.RoleArns), - Extract: common.ARNExtractor(), - References: mg.Spec.ForProvider.RoleArnsRefs, - Selector: mg.Spec.ForProvider.RoleArnsSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.RoleArns), + Extract: common.ARNExtractor(), + References: mg.Spec.ForProvider.RoleArnsRefs, + Selector: mg.Spec.ForProvider.RoleArnsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArns") } mg.Spec.ForProvider.RoleArns = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.RoleArnsRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.RoleArns), - Extract: common.ARNExtractor(), - References: mg.Spec.InitProvider.RoleArnsRefs, - Selector: mg.Spec.InitProvider.RoleArnsSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.RoleArns), + Extract: common.ARNExtractor(), + References: mg.Spec.InitProvider.RoleArnsRefs, + Selector: mg.Spec.InitProvider.RoleArnsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArns") } diff --git a/apis/route53/v1beta1/zz_generated.resolvers.go b/apis/route53/v1beta1/zz_generated.resolvers.go index 4858e04d5d..ad02143fd2 100644 --- a/apis/route53/v1beta1/zz_generated.resolvers.go +++ b/apis/route53/v1beta1/zz_generated.resolvers.go @@ -10,44 +10,67 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/cloudwatch/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this HealthCheck. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this HealthCheck. func (mg *HealthCheck) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatch.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchAlarmName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CloudwatchAlarmNameRef, - Selector: mg.Spec.ForProvider.CloudwatchAlarmNameSelector, - To: reference.To{ - List: &v1beta1.MetricAlarmList{}, - Managed: &v1beta1.MetricAlarm{}, - }, - }) + "MetricAlarm", + + "MetricAlarmList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CloudwatchAlarmName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CloudwatchAlarmNameRef, + Selector: mg.Spec.ForProvider.CloudwatchAlarmNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CloudwatchAlarmName") } mg.Spec.ForProvider.CloudwatchAlarmName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CloudwatchAlarmNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatch.aws.upbound.io", + + "v1beta1", + + "MetricAlarm", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchAlarmName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CloudwatchAlarmNameRef, - Selector: mg.Spec.InitProvider.CloudwatchAlarmNameSelector, - To: reference.To{ - List: &v1beta1.MetricAlarmList{}, - Managed: &v1beta1.MetricAlarm{}, - }, - }) + "MetricAlarmList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CloudwatchAlarmName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CloudwatchAlarmNameRef, + Selector: mg.Spec.InitProvider.CloudwatchAlarmNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CloudwatchAlarmName") } @@ -59,37 +82,58 @@ func (mg *HealthCheck) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this HostedZoneDNSSEC. func (mg *HostedZoneDNSSEC) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", + + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HostedZoneID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.HostedZoneIDRef, - Selector: mg.Spec.ForProvider.HostedZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HostedZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.HostedZoneIDRef, + Selector: mg.Spec.ForProvider.HostedZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HostedZoneID") } mg.Spec.ForProvider.HostedZoneID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HostedZoneIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HostedZoneID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.HostedZoneIDRef, - Selector: mg.Spec.InitProvider.HostedZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + "v1beta1", + + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HostedZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.HostedZoneIDRef, + Selector: mg.Spec.InitProvider.HostedZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HostedZoneID") } @@ -101,69 +145,110 @@ func (mg *HostedZoneDNSSEC) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this Record. func (mg *Record) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HealthCheckID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.HealthCheckIDRef, - Selector: mg.Spec.ForProvider.HealthCheckIDSelector, - To: reference.To{ - List: &HealthCheckList{}, - Managed: &HealthCheck{}, - }, - }) + "v1beta1", + + "HealthCheck", + + "HealthCheckList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HealthCheckID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.HealthCheckIDRef, + Selector: mg.Spec.ForProvider.HealthCheckIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HealthCheckID") } mg.Spec.ForProvider.HealthCheckID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HealthCheckIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ZoneID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ZoneIDRef, - Selector: mg.Spec.ForProvider.ZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ZoneIDRef, + Selector: mg.Spec.ForProvider.ZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ZoneID") } mg.Spec.ForProvider.ZoneID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ZoneIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HealthCheckID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.HealthCheckIDRef, - Selector: mg.Spec.InitProvider.HealthCheckIDSelector, - To: reference.To{ - List: &HealthCheckList{}, - Managed: &HealthCheck{}, - }, - }) + "v1beta1", + + "HealthCheck", + + "HealthCheckList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HealthCheckID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.HealthCheckIDRef, + Selector: mg.Spec.InitProvider.HealthCheckIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HealthCheckID") } mg.Spec.InitProvider.HealthCheckID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.HealthCheckIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", + + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ZoneID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ZoneIDRef, - Selector: mg.Spec.InitProvider.ZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ZoneIDRef, + Selector: mg.Spec.InitProvider.ZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ZoneID") } @@ -175,37 +260,56 @@ func (mg *Record) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this ResolverConfig. func (mg *ResolverConfig) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ResourceIDRef, - Selector: mg.Spec.InitProvider.ResourceIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ResourceIDRef, + Selector: mg.Spec.InitProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceID") } @@ -217,69 +321,108 @@ func (mg *ResolverConfig) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this TrafficPolicyInstance. func (mg *TrafficPolicyInstance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", + + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HostedZoneID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.HostedZoneIDRef, - Selector: mg.Spec.ForProvider.HostedZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HostedZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.HostedZoneIDRef, + Selector: mg.Spec.ForProvider.HostedZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HostedZoneID") } mg.Spec.ForProvider.HostedZoneID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HostedZoneIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", + + "TrafficPolicy", + + "TrafficPolicyList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TrafficPolicyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TrafficPolicyIDRef, - Selector: mg.Spec.ForProvider.TrafficPolicyIDSelector, - To: reference.To{ - List: &TrafficPolicyList{}, - Managed: &TrafficPolicy{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TrafficPolicyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TrafficPolicyIDRef, + Selector: mg.Spec.ForProvider.TrafficPolicyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TrafficPolicyID") } mg.Spec.ForProvider.TrafficPolicyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TrafficPolicyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HostedZoneID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.HostedZoneIDRef, - Selector: mg.Spec.InitProvider.HostedZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HostedZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.HostedZoneIDRef, + Selector: mg.Spec.InitProvider.HostedZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HostedZoneID") } mg.Spec.InitProvider.HostedZoneID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.HostedZoneIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TrafficPolicyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TrafficPolicyIDRef, - Selector: mg.Spec.InitProvider.TrafficPolicyIDSelector, - To: reference.To{ - List: &TrafficPolicyList{}, - Managed: &TrafficPolicy{}, - }, - }) + "TrafficPolicy", + + "TrafficPolicyList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TrafficPolicyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TrafficPolicyIDRef, + Selector: mg.Spec.InitProvider.TrafficPolicyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TrafficPolicyID") } @@ -291,69 +434,106 @@ func (mg *TrafficPolicyInstance) ResolveReferences(ctx context.Context, c client // ResolveReferences of this VPCAssociationAuthorization. func (mg *VPCAssociationAuthorization) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ZoneID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ZoneIDRef, - Selector: mg.Spec.ForProvider.ZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + "v1beta1", + + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ZoneIDRef, + Selector: mg.Spec.ForProvider.ZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ZoneID") } mg.Spec.ForProvider.ZoneID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ZoneIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } mg.Spec.InitProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ZoneID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ZoneIDRef, - Selector: mg.Spec.InitProvider.ZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ZoneIDRef, + Selector: mg.Spec.InitProvider.ZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ZoneID") } @@ -365,21 +545,33 @@ func (mg *VPCAssociationAuthorization) ResolveReferences(ctx context.Context, c // ResolveReferences of this Zone. func (mg *Zone) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", + + "DelegationSet", + + "DelegationSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DelegationSetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DelegationSetIDRef, - Selector: mg.Spec.ForProvider.DelegationSetIDSelector, - To: reference.To{ - List: &DelegationSetList{}, - Managed: &DelegationSet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DelegationSetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DelegationSetIDRef, + Selector: mg.Spec.ForProvider.DelegationSetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DelegationSetID") } @@ -387,16 +579,25 @@ func (mg *Zone) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.DelegationSetIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.VPC); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPC[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPC[i3].VPCIDRef, - Selector: mg.Spec.ForProvider.VPC[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPC[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPC[i3].VPCIDRef, + Selector: mg.Spec.ForProvider.VPC[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPC[i3].VPCID") } @@ -404,16 +605,26 @@ func (mg *Zone) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.ForProvider.VPC[i3].VPCIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DelegationSetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DelegationSetIDRef, - Selector: mg.Spec.InitProvider.DelegationSetIDSelector, - To: reference.To{ - List: &DelegationSetList{}, - Managed: &DelegationSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", + + "DelegationSet", + + "DelegationSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DelegationSetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DelegationSetIDRef, + Selector: mg.Spec.InitProvider.DelegationSetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DelegationSetID") } @@ -421,16 +632,25 @@ func (mg *Zone) ResolveReferences(ctx context.Context, c client.Reader) error { mg.Spec.InitProvider.DelegationSetIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.VPC); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPC[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPC[i3].VPCIDRef, - Selector: mg.Spec.InitProvider.VPC[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPC[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPC[i3].VPCIDRef, + Selector: mg.Spec.InitProvider.VPC[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPC[i3].VPCID") } @@ -444,69 +664,106 @@ func (mg *Zone) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this ZoneAssociation. func (mg *ZoneAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", + + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ZoneID), - Extract: resource.ExtractParamPath("zone_id", true), - Reference: mg.Spec.ForProvider.ZoneIDRef, - Selector: mg.Spec.ForProvider.ZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ZoneID), + Extract: resource.ExtractParamPath("zone_id", true), + Reference: mg.Spec.ForProvider.ZoneIDRef, + Selector: mg.Spec.ForProvider.ZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ZoneID") } mg.Spec.ForProvider.ZoneID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ZoneIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } mg.Spec.InitProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ZoneID), - Extract: resource.ExtractParamPath("zone_id", true), - Reference: mg.Spec.InitProvider.ZoneIDRef, - Selector: mg.Spec.InitProvider.ZoneIDSelector, - To: reference.To{ - List: &ZoneList{}, - Managed: &Zone{}, - }, - }) + "Zone", + "ZoneList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ZoneID), + Extract: resource.ExtractParamPath("zone_id", true), + Reference: mg.Spec.InitProvider.ZoneIDRef, + Selector: mg.Spec.InitProvider.ZoneIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ZoneID") } diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_generated.resolvers.go b/apis/route53recoverycontrolconfig/v1beta1/zz_generated.resolvers.go index a8760eef32..05e34eb2a7 100644 --- a/apis/route53recoverycontrolconfig/v1beta1/zz_generated.resolvers.go +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_generated.resolvers.go @@ -8,44 +8,64 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" errors "github.com/pkg/errors" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ControlPanel. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ControlPanel. func (mg *ControlPanel) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.ClusterArnRef, - Selector: mg.Spec.ForProvider.ClusterArnSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "Cluster", "ClusterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.ClusterArnRef, + Selector: mg.Spec.ForProvider.ClusterArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterArn") } mg.Spec.ForProvider.ClusterArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.ClusterArnRef, - Selector: mg.Spec.InitProvider.ClusterArnSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "v1beta1", + + "Cluster", "ClusterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.ClusterArnRef, + Selector: mg.Spec.InitProvider.ClusterArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterArn") } @@ -57,69 +77,100 @@ func (mg *ControlPanel) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this RoutingControl. func (mg *RoutingControl) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.ClusterArnRef, - Selector: mg.Spec.ForProvider.ClusterArnSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + "v1beta1", + + "Cluster", "ClusterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClusterArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.ClusterArnRef, + Selector: mg.Spec.ForProvider.ClusterArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ClusterArn") } mg.Spec.ForProvider.ClusterArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ClusterArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ControlPanelArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.ControlPanelArnRef, - Selector: mg.Spec.ForProvider.ControlPanelArnSelector, - To: reference.To{ - List: &ControlPanelList{}, - Managed: &ControlPanel{}, - }, - }) + "ControlPanel", "ControlPanelList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ControlPanelArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.ControlPanelArnRef, + Selector: mg.Spec.ForProvider.ControlPanelArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ControlPanelArn") } mg.Spec.ForProvider.ControlPanelArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ControlPanelArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", + + "v1beta1", + + "Cluster", "ClusterList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.ClusterArnRef, - Selector: mg.Spec.InitProvider.ClusterArnSelector, - To: reference.To{ - List: &ClusterList{}, - Managed: &Cluster{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClusterArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.ClusterArnRef, + Selector: mg.Spec.InitProvider.ClusterArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ClusterArn") } mg.Spec.InitProvider.ClusterArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ClusterArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", + + "v1beta1", + + "ControlPanel", "ControlPanelList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ControlPanelArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.ControlPanelArnRef, - Selector: mg.Spec.InitProvider.ControlPanelArnSelector, - To: reference.To{ - List: &ControlPanelList{}, - Managed: &ControlPanel{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ControlPanelArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.ControlPanelArnRef, + Selector: mg.Spec.InitProvider.ControlPanelArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ControlPanelArn") } @@ -131,70 +182,103 @@ func (mg *RoutingControl) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this SafetyRule. func (mg *SafetyRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.AssertedControls), - Extract: common.TerraformID(), - References: mg.Spec.ForProvider.AssertedControlsRefs, - Selector: mg.Spec.ForProvider.AssertedControlsSelector, - To: reference.To{ - List: &RoutingControlList{}, - Managed: &RoutingControl{}, - }, - }) + "v1beta1", + + "RoutingControl", "RoutingControlList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.AssertedControls), + Extract: common.TerraformID(), + References: mg.Spec.ForProvider.AssertedControlsRefs, + Selector: mg.Spec.ForProvider.AssertedControlsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AssertedControls") } mg.Spec.ForProvider.AssertedControls = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.AssertedControlsRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ControlPanelArn), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.ControlPanelArnRef, - Selector: mg.Spec.ForProvider.ControlPanelArnSelector, - To: reference.To{ - List: &ControlPanelList{}, - Managed: &ControlPanel{}, - }, - }) + "ControlPanel", "ControlPanelList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ControlPanelArn), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.ControlPanelArnRef, + Selector: mg.Spec.ForProvider.ControlPanelArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ControlPanelArn") } mg.Spec.ForProvider.ControlPanelArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ControlPanelArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", + + "v1beta1", + + "RoutingControl", "RoutingControlList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.AssertedControls), - Extract: common.TerraformID(), - References: mg.Spec.InitProvider.AssertedControlsRefs, - Selector: mg.Spec.InitProvider.AssertedControlsSelector, - To: reference.To{ - List: &RoutingControlList{}, - Managed: &RoutingControl{}, - }, - }) + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.AssertedControls), + Extract: common.TerraformID(), + References: mg.Spec.InitProvider.AssertedControlsRefs, + Selector: mg.Spec.InitProvider.AssertedControlsSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AssertedControls") } mg.Spec.InitProvider.AssertedControls = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.AssertedControlsRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("route53recoverycontrolconfig.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ControlPanelArn), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.ControlPanelArnRef, - Selector: mg.Spec.InitProvider.ControlPanelArnSelector, - To: reference.To{ - List: &ControlPanelList{}, - Managed: &ControlPanel{}, - }, - }) + "ControlPanel", "ControlPanelList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ControlPanelArn), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.ControlPanelArnRef, + Selector: mg.Spec.InitProvider.ControlPanelArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ControlPanelArn") } diff --git a/apis/route53recoveryreadiness/v1beta1/zz_generated.resolvers.go b/apis/route53recoveryreadiness/v1beta1/zz_generated.resolvers.go index ffb3a2942a..9b688913d4 100644 --- a/apis/route53recoveryreadiness/v1beta1/zz_generated.resolvers.go +++ b/apis/route53recoveryreadiness/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/cloudwatch/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ResourceSet. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ResourceSet. func (mg *ResourceSet) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Resources); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Resources[i3].ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Resources[i3].ResourceArnRef, - Selector: mg.Spec.ForProvider.Resources[i3].ResourceArnSelector, - To: reference.To{ - List: &v1beta1.MetricAlarmList{}, - Managed: &v1beta1.MetricAlarm{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatch.aws.upbound.io", + + "v1beta1", + + "MetricAlarm", + + "MetricAlarmList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Resources[i3].ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Resources[i3].ResourceArnRef, + Selector: mg.Spec.ForProvider.Resources[i3].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Resources[i3].ResourceArn") } @@ -40,16 +56,26 @@ func (mg *ResourceSet) ResolveReferences(ctx context.Context, c client.Reader) e } for i3 := 0; i3 < len(mg.Spec.InitProvider.Resources); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Resources[i3].ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Resources[i3].ResourceArnRef, - Selector: mg.Spec.InitProvider.Resources[i3].ResourceArnSelector, - To: reference.To{ - List: &v1beta1.MetricAlarmList{}, - Managed: &v1beta1.MetricAlarm{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cloudwatch.aws.upbound.io", + + "v1beta1", + + "MetricAlarm", + + "MetricAlarmList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Resources[i3].ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Resources[i3].ResourceArnRef, + Selector: mg.Spec.InitProvider.Resources[i3].ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Resources[i3].ResourceArn") } diff --git a/apis/route53resolver/v1beta1/zz_generated.resolvers.go b/apis/route53resolver/v1beta1/zz_generated.resolvers.go index d563dfd8ab..0b4bbdc192 100644 --- a/apis/route53resolver/v1beta1/zz_generated.resolvers.go +++ b/apis/route53resolver/v1beta1/zz_generated.resolvers.go @@ -10,12 +10,18 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Endpoint. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Endpoint. func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -23,16 +29,26 @@ func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) erro var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.IPAddress); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IPAddress[i3].SubnetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IPAddress[i3].SubnetIDRef, - Selector: mg.Spec.ForProvider.IPAddress[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IPAddress[i3].SubnetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IPAddress[i3].SubnetIDRef, + Selector: mg.Spec.ForProvider.IPAddress[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IPAddress[i3].SubnetID") } @@ -40,16 +56,26 @@ func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.IPAddress[i3].SubnetIDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SecurityGroupIDRefs, - Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") } @@ -57,16 +83,26 @@ func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.InitProvider.IPAddress); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IPAddress[i3].SubnetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IPAddress[i3].SubnetIDRef, - Selector: mg.Spec.InitProvider.IPAddress[i3].SubnetIDSelector, - To: reference.To{ - List: &v1beta1.SubnetList{}, - Managed: &v1beta1.Subnet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IPAddress[i3].SubnetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IPAddress[i3].SubnetIDRef, + Selector: mg.Spec.InitProvider.IPAddress[i3].SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IPAddress[i3].SubnetID") } @@ -74,16 +110,26 @@ func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.IPAddress[i3].SubnetIDRef = rsp.ResolvedReference } - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SecurityGroupIDRefs, - Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, - To: reference.To{ - List: &v1beta1.SecurityGroupList{}, - Managed: &v1beta1.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") } @@ -95,37 +141,56 @@ func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this Rule. func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53resolver.aws.upbound.io", + + "v1beta1", + "Endpoint", + + "EndpointList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResolverEndpointID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ResolverEndpointIDRef, - Selector: mg.Spec.ForProvider.ResolverEndpointIDSelector, - To: reference.To{ - List: &EndpointList{}, - Managed: &Endpoint{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResolverEndpointID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ResolverEndpointIDRef, + Selector: mg.Spec.ForProvider.ResolverEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResolverEndpointID") } mg.Spec.ForProvider.ResolverEndpointID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResolverEndpointIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53resolver.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResolverEndpointID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ResolverEndpointIDRef, - Selector: mg.Spec.InitProvider.ResolverEndpointIDSelector, - To: reference.To{ - List: &EndpointList{}, - Managed: &Endpoint{}, - }, - }) + "v1beta1", + "Endpoint", + + "EndpointList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResolverEndpointID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ResolverEndpointIDRef, + Selector: mg.Spec.InitProvider.ResolverEndpointIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResolverEndpointID") } @@ -137,69 +202,106 @@ func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this RuleAssociation. func (mg *RuleAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("route53resolver.aws.upbound.io", + + "v1beta1", + "Rule", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResolverRuleID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ResolverRuleIDRef, - Selector: mg.Spec.ForProvider.ResolverRuleIDSelector, - To: reference.To{ - List: &RuleList{}, - Managed: &Rule{}, - }, - }) + "RuleList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResolverRuleID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ResolverRuleIDRef, + Selector: mg.Spec.ForProvider.ResolverRuleIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResolverRuleID") } mg.Spec.ForProvider.ResolverRuleID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResolverRuleIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("route53resolver.aws.upbound.io", + + "v1beta1", + "Rule", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResolverRuleID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ResolverRuleIDRef, - Selector: mg.Spec.InitProvider.ResolverRuleIDSelector, - To: reference.To{ - List: &RuleList{}, - Managed: &Rule{}, - }, - }) + "RuleList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResolverRuleID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ResolverRuleIDRef, + Selector: mg.Spec.InitProvider.ResolverRuleIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResolverRuleID") } mg.Spec.InitProvider.ResolverRuleID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ResolverRuleIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } diff --git a/apis/rum/v1beta1/zz_generated.resolvers.go b/apis/rum/v1beta1/zz_generated.resolvers.go index a2f3d4cf61..617089c98b 100644 --- a/apis/rum/v1beta1/zz_generated.resolvers.go +++ b/apis/rum/v1beta1/zz_generated.resolvers.go @@ -9,76 +9,120 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this MetricsDestination. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this MetricsDestination. func (mg *MetricsDestination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("rum.aws.upbound.io", + + "v1beta1", + + "AppMonitor", + "AppMonitorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppMonitorName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.AppMonitorNameRef, - Selector: mg.Spec.ForProvider.AppMonitorNameSelector, - To: reference.To{ - List: &AppMonitorList{}, - Managed: &AppMonitor{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AppMonitorName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.AppMonitorNameRef, + Selector: mg.Spec.ForProvider.AppMonitorNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AppMonitorName") } mg.Spec.ForProvider.AppMonitorName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AppMonitorNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.IAMRoleArnRef, - Selector: mg.Spec.ForProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.IAMRoleArnRef, + Selector: mg.Spec.ForProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRoleArn") } mg.Spec.ForProvider.IAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("rum.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AppMonitorName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.AppMonitorNameRef, - Selector: mg.Spec.InitProvider.AppMonitorNameSelector, - To: reference.To{ - List: &AppMonitorList{}, - Managed: &AppMonitor{}, - }, - }) + "AppMonitor", + "AppMonitorList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AppMonitorName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.AppMonitorNameRef, + Selector: mg.Spec.InitProvider.AppMonitorNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AppMonitorName") } mg.Spec.InitProvider.AppMonitorName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.AppMonitorNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.IAMRoleArnRef, - Selector: mg.Spec.InitProvider.IAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.IAMRoleArnRef, + Selector: mg.Spec.InitProvider.IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRoleArn") } diff --git a/apis/s3/v1beta1/zz_generated.resolvers.go b/apis/s3/v1beta1/zz_generated.resolvers.go index 2d3bdc0001..1730330a02 100644 --- a/apis/s3/v1beta1/zz_generated.resolvers.go +++ b/apis/s3/v1beta1/zz_generated.resolvers.go @@ -10,46 +10,67 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta13 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/sns/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/sqs/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this BucketACL. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this BucketACL. func (mg *BucketACL) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -61,37 +82,58 @@ func (mg *BucketACL) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this BucketAccelerateConfiguration. func (mg *BucketAccelerateConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -103,21 +145,33 @@ func (mg *BucketAccelerateConfiguration) ResolveReferences(ctx context.Context, // ResolveReferences of this BucketAnalyticsConfiguration. func (mg *BucketAnalyticsConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } @@ -128,16 +182,26 @@ func (mg *BucketAnalyticsConfiguration) ResolveReferences(ctx context.Context, c for i4 := 0; i4 < len(mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArnRef, - Selector: mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArnSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArnRef, + Selector: mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArn") } @@ -148,16 +212,26 @@ func (mg *BucketAnalyticsConfiguration) ResolveReferences(ctx context.Context, c } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -168,16 +242,26 @@ func (mg *BucketAnalyticsConfiguration) ResolveReferences(ctx context.Context, c for i4 := 0; i4 < len(mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArnRef, - Selector: mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArnSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArnRef, + Selector: mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageClassAnalysis[i3].DataExport[i4].Destination[i5].S3BucketDestination[i6].BucketArn") } @@ -194,37 +278,58 @@ func (mg *BucketAnalyticsConfiguration) ResolveReferences(ctx context.Context, c // ResolveReferences of this BucketCorsConfiguration. func (mg *BucketCorsConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -236,37 +341,58 @@ func (mg *BucketCorsConfiguration) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this BucketIntelligentTieringConfiguration. func (mg *BucketIntelligentTieringConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -278,21 +404,33 @@ func (mg *BucketIntelligentTieringConfiguration) ResolveReferences(ctx context.C // ResolveReferences of this BucketInventory. func (mg *BucketInventory) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } @@ -301,16 +439,26 @@ func (mg *BucketInventory) ResolveReferences(ctx context.Context, c client.Reade for i3 := 0; i3 < len(mg.Spec.ForProvider.Destination); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Destination[i3].Bucket); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Destination[i3].Bucket[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Destination[i3].Bucket[i4].BucketArnRef, - Selector: mg.Spec.ForProvider.Destination[i3].Bucket[i4].BucketArnSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Destination[i3].Bucket[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Destination[i3].Bucket[i4].BucketArnRef, + Selector: mg.Spec.ForProvider.Destination[i3].Bucket[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Destination[i3].Bucket[i4].BucketArn") } @@ -319,16 +467,26 @@ func (mg *BucketInventory) ResolveReferences(ctx context.Context, c client.Reade } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -337,16 +495,26 @@ func (mg *BucketInventory) ResolveReferences(ctx context.Context, c client.Reade for i3 := 0; i3 < len(mg.Spec.InitProvider.Destination); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Destination[i3].Bucket); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Destination[i3].Bucket[i4].BucketArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Destination[i3].Bucket[i4].BucketArnRef, - Selector: mg.Spec.InitProvider.Destination[i3].Bucket[i4].BucketArnSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Destination[i3].Bucket[i4].BucketArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Destination[i3].Bucket[i4].BucketArnRef, + Selector: mg.Spec.InitProvider.Destination[i3].Bucket[i4].BucketArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Destination[i3].Bucket[i4].BucketArn") } @@ -361,37 +529,58 @@ func (mg *BucketInventory) ResolveReferences(ctx context.Context, c client.Reade // ResolveReferences of this BucketLifecycleConfiguration. func (mg *BucketLifecycleConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -403,69 +592,108 @@ func (mg *BucketLifecycleConfiguration) ResolveReferences(ctx context.Context, c // ResolveReferences of this BucketLogging. func (mg *BucketLogging) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetBucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TargetBucketRef, - Selector: mg.Spec.ForProvider.TargetBucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TargetBucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TargetBucketRef, + Selector: mg.Spec.ForProvider.TargetBucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TargetBucket") } mg.Spec.ForProvider.TargetBucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TargetBucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } mg.Spec.InitProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetBucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TargetBucketRef, - Selector: mg.Spec.InitProvider.TargetBucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TargetBucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TargetBucketRef, + Selector: mg.Spec.InitProvider.TargetBucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TargetBucket") } @@ -477,37 +705,58 @@ func (mg *BucketLogging) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this BucketMetric. func (mg *BucketMetric) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -519,21 +768,33 @@ func (mg *BucketMetric) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this BucketNotification. func (mg *BucketNotification) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } @@ -541,16 +802,26 @@ func (mg *BucketNotification) ResolveReferences(ctx context.Context, c client.Re mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.Queue); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Queue[i3].QueueArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Queue[i3].QueueArnRef, - Selector: mg.Spec.ForProvider.Queue[i3].QueueArnSelector, - To: reference.To{ - List: &v1beta1.QueueList{}, - Managed: &v1beta1.Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Queue[i3].QueueArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Queue[i3].QueueArnRef, + Selector: mg.Spec.ForProvider.Queue[i3].QueueArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Queue[i3].QueueArn") } @@ -559,16 +830,26 @@ func (mg *BucketNotification) ResolveReferences(ctx context.Context, c client.Re } for i3 := 0; i3 < len(mg.Spec.ForProvider.Topic); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Topic[i3].TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Topic[i3].TopicArnRef, - Selector: mg.Spec.ForProvider.Topic[i3].TopicArnSelector, - To: reference.To{ - List: &v1beta11.TopicList{}, - Managed: &v1beta11.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Topic[i3].TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Topic[i3].TopicArnRef, + Selector: mg.Spec.ForProvider.Topic[i3].TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Topic[i3].TopicArn") } @@ -576,16 +857,26 @@ func (mg *BucketNotification) ResolveReferences(ctx context.Context, c client.Re mg.Spec.ForProvider.Topic[i3].TopicArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -593,16 +884,26 @@ func (mg *BucketNotification) ResolveReferences(ctx context.Context, c client.Re mg.Spec.InitProvider.BucketRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.Queue); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Queue[i3].QueueArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Queue[i3].QueueArnRef, - Selector: mg.Spec.InitProvider.Queue[i3].QueueArnSelector, - To: reference.To{ - List: &v1beta1.QueueList{}, - Managed: &v1beta1.Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Queue[i3].QueueArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Queue[i3].QueueArnRef, + Selector: mg.Spec.InitProvider.Queue[i3].QueueArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Queue[i3].QueueArn") } @@ -611,16 +912,26 @@ func (mg *BucketNotification) ResolveReferences(ctx context.Context, c client.Re } for i3 := 0; i3 < len(mg.Spec.InitProvider.Topic); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Topic[i3].TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Topic[i3].TopicArnRef, - Selector: mg.Spec.InitProvider.Topic[i3].TopicArnSelector, - To: reference.To{ - List: &v1beta11.TopicList{}, - Managed: &v1beta11.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Topic[i3].TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Topic[i3].TopicArnRef, + Selector: mg.Spec.InitProvider.Topic[i3].TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Topic[i3].TopicArn") } @@ -634,69 +945,106 @@ func (mg *BucketNotification) ResolveReferences(ctx context.Context, c client.Re // ResolveReferences of this BucketObject. func (mg *BucketObject) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } mg.Spec.InitProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -708,37 +1056,58 @@ func (mg *BucketObject) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this BucketObjectLockConfiguration. func (mg *BucketObjectLockConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -750,37 +1119,58 @@ func (mg *BucketObjectLockConfiguration) ResolveReferences(ctx context.Context, // ResolveReferences of this BucketOwnershipControls. func (mg *BucketOwnershipControls) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -792,37 +1182,58 @@ func (mg *BucketOwnershipControls) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this BucketPolicy. func (mg *BucketPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -834,37 +1245,58 @@ func (mg *BucketPolicy) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this BucketPublicAccessBlock. func (mg *BucketPublicAccessBlock) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -876,37 +1308,59 @@ func (mg *BucketPublicAccessBlock) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this BucketReplicationConfiguration. func (mg *BucketReplicationConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RoleRef, - Selector: mg.Spec.ForProvider.RoleSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RoleRef, + Selector: mg.Spec.ForProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Role") } @@ -915,16 +1369,26 @@ func (mg *BucketReplicationConfiguration) ResolveReferences(ctx context.Context, for i3 := 0; i3 < len(mg.Spec.ForProvider.Rule); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Rule[i3].Destination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule[i3].Destination[i4].Bucket), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Rule[i3].Destination[i4].BucketRef, - Selector: mg.Spec.ForProvider.Rule[i3].Destination[i4].BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule[i3].Destination[i4].Bucket), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Rule[i3].Destination[i4].BucketRef, + Selector: mg.Spec.ForProvider.Rule[i3].Destination[i4].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Rule[i3].Destination[i4].Bucket") } @@ -933,32 +1397,52 @@ func (mg *BucketReplicationConfiguration) ResolveReferences(ctx context.Context, } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } mg.Spec.InitProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RoleRef, - Selector: mg.Spec.InitProvider.RoleSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RoleRef, + Selector: mg.Spec.InitProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Role") } @@ -967,16 +1451,26 @@ func (mg *BucketReplicationConfiguration) ResolveReferences(ctx context.Context, for i3 := 0; i3 < len(mg.Spec.InitProvider.Rule); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Rule[i3].Destination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule[i3].Destination[i4].Bucket), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Rule[i3].Destination[i4].BucketRef, - Selector: mg.Spec.InitProvider.Rule[i3].Destination[i4].BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule[i3].Destination[i4].Bucket), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Rule[i3].Destination[i4].BucketRef, + Selector: mg.Spec.InitProvider.Rule[i3].Destination[i4].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Rule[i3].Destination[i4].Bucket") } @@ -991,37 +1485,58 @@ func (mg *BucketReplicationConfiguration) ResolveReferences(ctx context.Context, // ResolveReferences of this BucketRequestPaymentConfiguration. func (mg *BucketRequestPaymentConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -1033,21 +1548,33 @@ func (mg *BucketRequestPaymentConfiguration) ResolveReferences(ctx context.Conte // ResolveReferences of this BucketServerSideEncryptionConfiguration. func (mg *BucketServerSideEncryptionConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } @@ -1056,16 +1583,25 @@ func (mg *BucketServerSideEncryptionConfiguration) ResolveReferences(ctx context for i3 := 0; i3 < len(mg.Spec.ForProvider.Rule); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Rule[i3].ApplyServerSideEncryptionByDefault); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyIDRef, - Selector: mg.Spec.ForProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyIDRef, + Selector: mg.Spec.ForProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyID") } @@ -1074,16 +1610,26 @@ func (mg *BucketServerSideEncryptionConfiguration) ResolveReferences(ctx context } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -1092,16 +1638,25 @@ func (mg *BucketServerSideEncryptionConfiguration) ResolveReferences(ctx context for i3 := 0; i3 < len(mg.Spec.InitProvider.Rule); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Rule[i3].ApplyServerSideEncryptionByDefault); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyIDRef, - Selector: mg.Spec.InitProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyIDRef, + Selector: mg.Spec.InitProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Rule[i3].ApplyServerSideEncryptionByDefault[i4].KMSMasterKeyID") } @@ -1116,37 +1671,58 @@ func (mg *BucketServerSideEncryptionConfiguration) ResolveReferences(ctx context // ResolveReferences of this BucketVersioning. func (mg *BucketVersioning) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -1158,37 +1734,58 @@ func (mg *BucketVersioning) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this BucketWebsiteConfiguration. func (mg *BucketWebsiteConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -1200,69 +1797,106 @@ func (mg *BucketWebsiteConfiguration) ResolveReferences(ctx context.Context, c c // ResolveReferences of this Object. func (mg *Object) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } mg.Spec.ForProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &BucketList{}, - Managed: &Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } mg.Spec.InitProvider.Bucket = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BucketRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } diff --git a/apis/s3control/v1beta1/zz_generated.resolvers.go b/apis/s3control/v1beta1/zz_generated.resolvers.go index 7edb761a47..69035bcfd1 100644 --- a/apis/s3control/v1beta1/zz_generated.resolvers.go +++ b/apis/s3control/v1beta1/zz_generated.resolvers.go @@ -10,29 +10,42 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/lambda/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AccessPoint. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this AccessPoint. func (mg *AccessPoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BucketRef, - Selector: mg.Spec.ForProvider.BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BucketRef, + Selector: mg.Spec.ForProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Bucket") } @@ -40,16 +53,25 @@ func (mg *AccessPoint) ResolveReferences(ctx context.Context, c client.Reader) e mg.Spec.ForProvider.BucketRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.VPCConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCConfiguration[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDRef, - Selector: mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCConfiguration[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDRef, + Selector: mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCConfiguration[i3].VPCID") } @@ -57,16 +79,26 @@ func (mg *AccessPoint) ResolveReferences(ctx context.Context, c client.Reader) e mg.Spec.ForProvider.VPCConfiguration[i3].VPCIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BucketRef, - Selector: mg.Spec.InitProvider.BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BucketRef, + Selector: mg.Spec.InitProvider.BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Bucket") } @@ -74,16 +106,25 @@ func (mg *AccessPoint) ResolveReferences(ctx context.Context, c client.Reader) e mg.Spec.InitProvider.BucketRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.VPCConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCConfiguration[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.VPCConfiguration[i3].VPCIDRef, - Selector: mg.Spec.InitProvider.VPCConfiguration[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta11.VPCList{}, - Managed: &v1beta11.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCConfiguration[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.VPCConfiguration[i3].VPCIDRef, + Selector: mg.Spec.InitProvider.VPCConfiguration[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCConfiguration[i3].VPCID") } @@ -97,37 +138,58 @@ func (mg *AccessPoint) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this AccessPointPolicy. func (mg *AccessPointPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3control.aws.upbound.io", + + "v1beta1", + + "AccessPoint", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AccessPointArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.AccessPointArnRef, - Selector: mg.Spec.ForProvider.AccessPointArnSelector, - To: reference.To{ - List: &AccessPointList{}, - Managed: &AccessPoint{}, - }, - }) + "AccessPointList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.AccessPointArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.AccessPointArnRef, + Selector: mg.Spec.ForProvider.AccessPointArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.AccessPointArn") } mg.Spec.ForProvider.AccessPointArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.AccessPointArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3control.aws.upbound.io", + + "v1beta1", + + "AccessPoint", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AccessPointArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.AccessPointArnRef, - Selector: mg.Spec.InitProvider.AccessPointArnSelector, - To: reference.To{ - List: &AccessPointList{}, - Managed: &AccessPoint{}, - }, - }) + "AccessPointList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.AccessPointArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.AccessPointArnRef, + Selector: mg.Spec.InitProvider.AccessPointArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.AccessPointArn") } @@ -139,6 +201,9 @@ func (mg *AccessPointPolicy) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this MultiRegionAccessPoint. func (mg *MultiRegionAccessPoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -146,16 +211,26 @@ func (mg *MultiRegionAccessPoint) ResolveReferences(ctx context.Context, c clien for i3 := 0; i3 < len(mg.Spec.ForProvider.Details); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Details[i3].Region); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Details[i3].Region[i4].Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Details[i3].Region[i4].BucketRef, - Selector: mg.Spec.ForProvider.Details[i3].Region[i4].BucketSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Details[i3].Region[i4].Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Details[i3].Region[i4].BucketRef, + Selector: mg.Spec.ForProvider.Details[i3].Region[i4].BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Details[i3].Region[i4].Bucket") } @@ -170,22 +245,35 @@ func (mg *MultiRegionAccessPoint) ResolveReferences(ctx context.Context, c clien // ResolveReferences of this ObjectLambdaAccessPoint. func (mg *ObjectLambdaAccessPoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Configuration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].SupportingAccessPoint), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Configuration[i3].SupportingAccessPointRef, - Selector: mg.Spec.ForProvider.Configuration[i3].SupportingAccessPointSelector, - To: reference.To{ - List: &AccessPointList{}, - Managed: &AccessPoint{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3control.aws.upbound.io", + + "v1beta1", + + "AccessPoint", + + "AccessPointList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].SupportingAccessPoint), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Configuration[i3].SupportingAccessPointRef, + Selector: mg.Spec.ForProvider.Configuration[i3].SupportingAccessPointSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Configuration[i3].SupportingAccessPoint") } @@ -197,16 +285,26 @@ func (mg *ObjectLambdaAccessPoint) ResolveReferences(ctx context.Context, c clie for i4 := 0; i4 < len(mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation); i5++ { for i6 := 0; i6 < len(mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArnRef, - Selector: mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArnSelector, - To: reference.To{ - List: &v1beta12.FunctionList{}, - Managed: &v1beta12.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArnRef, + Selector: mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArn") } @@ -218,16 +316,26 @@ func (mg *ObjectLambdaAccessPoint) ResolveReferences(ctx context.Context, c clie } } for i3 := 0; i3 < len(mg.Spec.InitProvider.Configuration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].SupportingAccessPoint), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Configuration[i3].SupportingAccessPointRef, - Selector: mg.Spec.InitProvider.Configuration[i3].SupportingAccessPointSelector, - To: reference.To{ - List: &AccessPointList{}, - Managed: &AccessPoint{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3control.aws.upbound.io", + + "v1beta1", + + "AccessPoint", + + "AccessPointList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].SupportingAccessPoint), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Configuration[i3].SupportingAccessPointRef, + Selector: mg.Spec.InitProvider.Configuration[i3].SupportingAccessPointSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Configuration[i3].SupportingAccessPoint") } @@ -239,16 +347,26 @@ func (mg *ObjectLambdaAccessPoint) ResolveReferences(ctx context.Context, c clie for i4 := 0; i4 < len(mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation); i5++ { for i6 := 0; i6 < len(mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda); i6++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArnRef, - Selector: mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArnSelector, - To: reference.To{ - List: &v1beta12.FunctionList{}, - Managed: &v1beta12.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArnRef, + Selector: mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Configuration[i3].TransformationConfiguration[i4].ContentTransformation[i5].AwsLambda[i6].FunctionArn") } @@ -265,37 +383,60 @@ func (mg *ObjectLambdaAccessPoint) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this ObjectLambdaAccessPointPolicy. func (mg *ObjectLambdaAccessPointPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("s3control.aws.upbound.io", + + "v1beta1", + + "ObjectLambdaAccessPoint", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Name), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.ForProvider.NameRef, - Selector: mg.Spec.ForProvider.NameSelector, - To: reference.To{ - List: &ObjectLambdaAccessPointList{}, - Managed: &ObjectLambdaAccessPoint{}, - }, - }) + "ObjectLambdaAccessPointList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Name), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.ForProvider.NameRef, + Selector: mg.Spec.ForProvider.NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Name") } mg.Spec.ForProvider.Name = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("s3control.aws.upbound.io", + + "v1beta1", + + "ObjectLambdaAccessPoint", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Name), - Extract: resource.ExtractParamPath("name", false), - Reference: mg.Spec.InitProvider.NameRef, - Selector: mg.Spec.InitProvider.NameSelector, - To: reference.To{ - List: &ObjectLambdaAccessPointList{}, - Managed: &ObjectLambdaAccessPoint{}, - }, - }) + "ObjectLambdaAccessPointList") + if err != nil { + return errors. + Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Name), + Extract: resource.ExtractParamPath("name", false), + Reference: mg.Spec.InitProvider.NameRef, + Selector: mg.Spec.InitProvider.NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Name") } @@ -307,6 +448,9 @@ func (mg *ObjectLambdaAccessPointPolicy) ResolveReferences(ctx context.Context, // ResolveReferences of this StorageLensConfiguration. func (mg *StorageLensConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -315,16 +459,26 @@ func (mg *StorageLensConfiguration) ResolveReferences(ctx context.Context, c cli for i3 := 0; i3 < len(mg.Spec.ForProvider.StorageLensConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].ArnRef, - Selector: mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].ArnSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].ArnRef, + Selector: mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].Arn") } @@ -337,16 +491,26 @@ func (mg *StorageLensConfiguration) ResolveReferences(ctx context.Context, c cli for i3 := 0; i3 < len(mg.Spec.InitProvider.StorageLensConfiguration); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].ArnRef, - Selector: mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].ArnSelector, - To: reference.To{ - List: &v1beta1.BucketList{}, - Managed: &v1beta1.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].ArnRef, + Selector: mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.StorageLensConfiguration[i3].DataExport[i4].S3BucketDestination[i5].Arn") } diff --git a/apis/sagemaker/v1beta1/zz_generated.resolvers.go b/apis/sagemaker/v1beta1/zz_generated.resolvers.go index 5e3c09d4c1..02a1cad719 100644 --- a/apis/sagemaker/v1beta1/zz_generated.resolvers.go +++ b/apis/sagemaker/v1beta1/zz_generated.resolvers.go @@ -10,80 +10,118 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta14 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/secretsmanager/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this App. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this App. func (mg *App) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DomainIDRef, - Selector: mg.Spec.ForProvider.DomainIDSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DomainIDRef, + Selector: mg.Spec.ForProvider.DomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainID") } mg.Spec.ForProvider.DomainID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "UserProfile", + + "UserProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserProfileName), - Extract: resource.ExtractParamPath("user_profile_name", false), - Reference: mg.Spec.ForProvider.UserProfileNameRef, - Selector: mg.Spec.ForProvider.UserProfileNameSelector, - To: reference.To{ - List: &UserProfileList{}, - Managed: &UserProfile{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserProfileName), + Extract: resource.ExtractParamPath("user_profile_name", false), + Reference: mg.Spec.ForProvider.UserProfileNameRef, + Selector: mg.Spec.ForProvider.UserProfileNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserProfileName") } mg.Spec.ForProvider.UserProfileName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserProfileNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DomainIDRef, - Selector: mg.Spec.InitProvider.DomainIDSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DomainIDRef, + Selector: mg.Spec.InitProvider.DomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainID") } mg.Spec.InitProvider.DomainID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DomainIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "UserProfile", + + "UserProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserProfileName), - Extract: resource.ExtractParamPath("user_profile_name", false), - Reference: mg.Spec.InitProvider.UserProfileNameRef, - Selector: mg.Spec.InitProvider.UserProfileNameSelector, - To: reference.To{ - List: &UserProfileList{}, - Managed: &UserProfile{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserProfileName), + Extract: resource.ExtractParamPath("user_profile_name", false), + Reference: mg.Spec.InitProvider.UserProfileNameRef, + Selector: mg.Spec.InitProvider.UserProfileNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserProfileName") } @@ -95,22 +133,34 @@ func (mg *App) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this CodeRepository. func (mg *CodeRepository) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.GitConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GitConfig[i3].SecretArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.GitConfig[i3].SecretArnRef, - Selector: mg.Spec.ForProvider.GitConfig[i3].SecretArnSelector, - To: reference.To{ - List: &v1beta1.SecretList{}, - Managed: &v1beta1.Secret{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.GitConfig[i3].SecretArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.GitConfig[i3].SecretArnRef, + Selector: mg.Spec.ForProvider.GitConfig[i3].SecretArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.GitConfig[i3].SecretArn") } @@ -119,16 +169,25 @@ func (mg *CodeRepository) ResolveReferences(ctx context.Context, c client.Reader } for i3 := 0; i3 < len(mg.Spec.InitProvider.GitConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GitConfig[i3].SecretArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.GitConfig[i3].SecretArnRef, - Selector: mg.Spec.InitProvider.GitConfig[i3].SecretArnSelector, - To: reference.To{ - List: &v1beta1.SecretList{}, - Managed: &v1beta1.Secret{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.GitConfig[i3].SecretArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.GitConfig[i3].SecretArnRef, + Selector: mg.Spec.InitProvider.GitConfig[i3].SecretArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.GitConfig[i3].SecretArn") } @@ -142,37 +201,58 @@ func (mg *CodeRepository) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this Device. func (mg *Device) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "DeviceFleet", + + "DeviceFleetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceFleetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DeviceFleetNameRef, - Selector: mg.Spec.ForProvider.DeviceFleetNameSelector, - To: reference.To{ - List: &DeviceFleetList{}, - Managed: &DeviceFleet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeviceFleetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DeviceFleetNameRef, + Selector: mg.Spec.ForProvider.DeviceFleetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeviceFleetName") } mg.Spec.ForProvider.DeviceFleetName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeviceFleetNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "DeviceFleet", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeviceFleetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DeviceFleetNameRef, - Selector: mg.Spec.InitProvider.DeviceFleetNameSelector, - To: reference.To{ - List: &DeviceFleetList{}, - Managed: &DeviceFleet{}, - }, - }) + "DeviceFleetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeviceFleetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DeviceFleetNameRef, + Selector: mg.Spec.InitProvider.DeviceFleetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DeviceFleetName") } @@ -184,37 +264,60 @@ func (mg *Device) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this DeviceFleet. func (mg *DeviceFleet) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -226,6 +329,9 @@ func (mg *DeviceFleet) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Domain. func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -233,16 +339,27 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.DefaultUserSettings); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultUserSettings[i3].ExecutionRole), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.DefaultUserSettings[i3].ExecutionRoleRef, - Selector: mg.Spec.ForProvider.DefaultUserSettings[i3].ExecutionRoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultUserSettings[i3].ExecutionRole), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.DefaultUserSettings[i3].ExecutionRoleRef, + Selector: mg.Spec.ForProvider.DefaultUserSettings[i3].ExecutionRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultUserSettings[i3].ExecutionRole") } @@ -253,16 +370,26 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.ForProvider.DefaultUserSettings); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigNameRef, - Selector: mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigNameSelector, - To: reference.To{ - List: &AppImageConfigList{}, - Managed: &AppImageConfig{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "AppImageConfig", + + "AppImageConfigList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigNameRef, + Selector: mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigName") } @@ -275,16 +402,26 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.ForProvider.DefaultUserSettings); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageName), - Extract: resource.ExtractParamPath("image_name", false), - Reference: mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageNameRef, - Selector: mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageNameSelector, - To: reference.To{ - List: &ImageVersionList{}, - Managed: &ImageVersion{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "ImageVersion", + + "ImageVersionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageName), + Extract: resource.ExtractParamPath("image_name", false), + Reference: mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageNameRef, + Selector: mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageName") } @@ -294,48 +431,74 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCIDRef, - Selector: mg.Spec.ForProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta13.VPCList{}, - Managed: &v1beta13.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") } @@ -343,16 +506,27 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.DefaultUserSettings); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultUserSettings[i3].ExecutionRole), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.DefaultUserSettings[i3].ExecutionRoleRef, - Selector: mg.Spec.InitProvider.DefaultUserSettings[i3].ExecutionRoleSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultUserSettings[i3].ExecutionRole), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.DefaultUserSettings[i3].ExecutionRoleRef, + Selector: mg.Spec.InitProvider.DefaultUserSettings[i3].ExecutionRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultUserSettings[i3].ExecutionRole") } @@ -363,16 +537,26 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.InitProvider.DefaultUserSettings); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigNameRef, - Selector: mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigNameSelector, - To: reference.To{ - List: &AppImageConfigList{}, - Managed: &AppImageConfig{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "AppImageConfig", + + "AppImageConfigList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigNameRef, + Selector: mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].AppImageConfigName") } @@ -385,16 +569,26 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error for i3 := 0; i3 < len(mg.Spec.InitProvider.DefaultUserSettings); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageName), - Extract: resource.ExtractParamPath("image_name", false), - Reference: mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageNameRef, - Selector: mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageNameSelector, - To: reference.To{ - List: &ImageVersionList{}, - Managed: &ImageVersion{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "ImageVersion", + + "ImageVersionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageName), + Extract: resource.ExtractParamPath("image_name", false), + Reference: mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageNameRef, + Selector: mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultUserSettings[i3].KernelGatewayAppSettings[i4].CustomImage[i5].ImageName") } @@ -404,48 +598,74 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error } } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } mg.Spec.InitProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.InitProvider.SubnetIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCIDRef, - Selector: mg.Spec.InitProvider.VPCIDSelector, - To: reference.To{ - List: &v1beta13.VPCList{}, - Managed: &v1beta13.VPC{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") } @@ -457,37 +677,58 @@ func (mg *Domain) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Endpoint. func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "EndpointConfiguration", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EndpointConfigName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.EndpointConfigNameRef, - Selector: mg.Spec.ForProvider.EndpointConfigNameSelector, - To: reference.To{ - List: &EndpointConfigurationList{}, - Managed: &EndpointConfiguration{}, - }, - }) + "EndpointConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EndpointConfigName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.EndpointConfigNameRef, + Selector: mg.Spec.ForProvider.EndpointConfigNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EndpointConfigName") } mg.Spec.ForProvider.EndpointConfigName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EndpointConfigNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EndpointConfigName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.EndpointConfigNameRef, - Selector: mg.Spec.InitProvider.EndpointConfigNameSelector, - To: reference.To{ - List: &EndpointConfigurationList{}, - Managed: &EndpointConfiguration{}, - }, - }) + "EndpointConfiguration", + + "EndpointConfigurationList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EndpointConfigName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.EndpointConfigNameRef, + Selector: mg.Spec.InitProvider.EndpointConfigNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EndpointConfigName") } @@ -499,21 +740,32 @@ func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this EndpointConfiguration. func (mg *EndpointConfiguration) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } @@ -521,16 +773,26 @@ func (mg *EndpointConfiguration) ResolveReferences(ctx context.Context, c client mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.ProductionVariants); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProductionVariants[i3].ModelName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ProductionVariants[i3].ModelNameRef, - Selector: mg.Spec.ForProvider.ProductionVariants[i3].ModelNameSelector, - To: reference.To{ - List: &ModelList{}, - Managed: &Model{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "Model", + "ModelList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProductionVariants[i3].ModelName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ProductionVariants[i3].ModelNameRef, + Selector: mg.Spec.ForProvider.ProductionVariants[i3].ModelNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProductionVariants[i3].ModelName") } @@ -538,16 +800,25 @@ func (mg *EndpointConfiguration) ResolveReferences(ctx context.Context, c client mg.Spec.ForProvider.ProductionVariants[i3].ModelNameRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } @@ -555,16 +826,26 @@ func (mg *EndpointConfiguration) ResolveReferences(ctx context.Context, c client mg.Spec.InitProvider.KMSKeyArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.ProductionVariants); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProductionVariants[i3].ModelName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ProductionVariants[i3].ModelNameRef, - Selector: mg.Spec.InitProvider.ProductionVariants[i3].ModelNameSelector, - To: reference.To{ - List: &ModelList{}, - Managed: &Model{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "Model", + "ModelList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProductionVariants[i3].ModelName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ProductionVariants[i3].ModelNameRef, + Selector: mg.Spec.InitProvider.ProductionVariants[i3].ModelNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProductionVariants[i3].ModelName") } @@ -578,39 +859,62 @@ func (mg *EndpointConfiguration) ResolveReferences(ctx context.Context, c client // ResolveReferences of this FeatureGroup. func (mg *FeatureGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) - if err != nil { - return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") - } - mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) - mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) - if err != nil { - return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") + } + mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } mg.Spec.InitProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference @@ -620,37 +924,60 @@ func (mg *FeatureGroup) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Image. func (mg *Image) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } @@ -662,37 +989,58 @@ func (mg *Image) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this ImageVersion. func (mg *ImageVersion) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ImageName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ImageNameRef, - Selector: mg.Spec.ForProvider.ImageNameSelector, - To: reference.To{ - List: &ImageList{}, - Managed: &Image{}, - }, - }) + "v1beta1", + + "Image", + "ImageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ImageName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ImageNameRef, + Selector: mg.Spec.ForProvider.ImageNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ImageName") } mg.Spec.ForProvider.ImageName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ImageNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ImageName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ImageNameRef, - Selector: mg.Spec.InitProvider.ImageNameSelector, - To: reference.To{ - List: &ImageList{}, - Managed: &Image{}, - }, - }) + "v1beta1", + + "Image", + "ImageList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ImageName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ImageNameRef, + Selector: mg.Spec.InitProvider.ImageNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ImageName") } @@ -704,37 +1052,60 @@ func (mg *ImageVersion) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Model. func (mg *Model) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ExecutionRoleArnRef, - Selector: mg.Spec.ForProvider.ExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ExecutionRoleArnRef, + Selector: mg.Spec.ForProvider.ExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ExecutionRoleArn") } mg.Spec.ForProvider.ExecutionRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ExecutionRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExecutionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ExecutionRoleArnRef, - Selector: mg.Spec.InitProvider.ExecutionRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ExecutionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ExecutionRoleArnRef, + Selector: mg.Spec.InitProvider.ExecutionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ExecutionRoleArn") } @@ -746,37 +1117,58 @@ func (mg *Model) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this ModelPackageGroupPolicy. func (mg *ModelPackageGroupPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ModelPackageGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ModelPackageGroupNameRef, - Selector: mg.Spec.ForProvider.ModelPackageGroupNameSelector, - To: reference.To{ - List: &ModelPackageGroupList{}, - Managed: &ModelPackageGroup{}, - }, - }) + "v1beta1", + + "ModelPackageGroup", + + "ModelPackageGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ModelPackageGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ModelPackageGroupNameRef, + Selector: mg.Spec.ForProvider.ModelPackageGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ModelPackageGroupName") } mg.Spec.ForProvider.ModelPackageGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ModelPackageGroupNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ModelPackageGroupName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ModelPackageGroupNameRef, - Selector: mg.Spec.InitProvider.ModelPackageGroupNameSelector, - To: reference.To{ - List: &ModelPackageGroupList{}, - Managed: &ModelPackageGroup{}, - }, - }) + "ModelPackageGroup", + + "ModelPackageGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ModelPackageGroupName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ModelPackageGroupNameRef, + Selector: mg.Spec.InitProvider.ModelPackageGroupNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ModelPackageGroupName") } @@ -788,133 +1180,208 @@ func (mg *ModelPackageGroupPolicy) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this NotebookInstance. func (mg *NotebookInstance) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "CodeRepository", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultCodeRepository), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DefaultCodeRepositoryRef, - Selector: mg.Spec.ForProvider.DefaultCodeRepositorySelector, - To: reference.To{ - List: &CodeRepositoryList{}, - Managed: &CodeRepository{}, - }, - }) + "CodeRepositoryList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DefaultCodeRepository), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DefaultCodeRepositoryRef, + Selector: mg.Spec.ForProvider.DefaultCodeRepositorySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DefaultCodeRepository") } mg.Spec.ForProvider.DefaultCodeRepository = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DefaultCodeRepositoryRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.SubnetIDRef, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") } mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultCodeRepository), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DefaultCodeRepositoryRef, - Selector: mg.Spec.InitProvider.DefaultCodeRepositorySelector, - To: reference.To{ - List: &CodeRepositoryList{}, - Managed: &CodeRepository{}, - }, - }) + "v1beta1", + + "CodeRepository", + + "CodeRepositoryList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DefaultCodeRepository), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DefaultCodeRepositoryRef, + Selector: mg.Spec.InitProvider.DefaultCodeRepositorySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DefaultCodeRepository") } mg.Spec.InitProvider.DefaultCodeRepository = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DefaultCodeRepositoryRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta12.KeyList{}, - Managed: &v1beta12.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } mg.Spec.InitProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.SubnetIDRef, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta13.SubnetList{}, - Managed: &v1beta13.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") } @@ -926,37 +1393,58 @@ func (mg *NotebookInstance) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this Space. func (mg *Space) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DomainIDRef, - Selector: mg.Spec.ForProvider.DomainIDSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DomainIDRef, + Selector: mg.Spec.ForProvider.DomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainID") } mg.Spec.ForProvider.DomainID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DomainIDRef, - Selector: mg.Spec.InitProvider.DomainIDSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DomainIDRef, + Selector: mg.Spec.InitProvider.DomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainID") } @@ -968,37 +1456,58 @@ func (mg *Space) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this UserProfile. func (mg *UserProfile) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DomainIDRef, - Selector: mg.Spec.ForProvider.DomainIDSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DomainIDRef, + Selector: mg.Spec.ForProvider.DomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DomainID") } mg.Spec.ForProvider.DomainID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DomainIDRef, - Selector: mg.Spec.InitProvider.DomainIDSelector, - To: reference.To{ - List: &DomainList{}, - Managed: &Domain{}, - }, - }) + "v1beta1", + + "Domain", + "DomainList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DomainID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DomainIDRef, + Selector: mg.Spec.InitProvider.DomainIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DomainID") } @@ -1010,22 +1519,35 @@ func (mg *UserProfile) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this Workforce. func (mg *Workforce) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.CognitoConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CognitoConfig[i3].ClientID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.CognitoConfig[i3].ClientIDRef, - Selector: mg.Spec.ForProvider.CognitoConfig[i3].ClientIDSelector, - To: reference.To{ - List: &v1beta14.UserPoolClientList{}, - Managed: &v1beta14.UserPoolClient{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CognitoConfig[i3].ClientID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.CognitoConfig[i3].ClientIDRef, + Selector: mg.Spec.ForProvider.CognitoConfig[i3].ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CognitoConfig[i3].ClientID") } @@ -1034,16 +1556,26 @@ func (mg *Workforce) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.ForProvider.CognitoConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CognitoConfig[i3].UserPool), - Extract: resource.ExtractParamPath("user_pool_id", false), - Reference: mg.Spec.ForProvider.CognitoConfig[i3].UserPoolRef, - Selector: mg.Spec.ForProvider.CognitoConfig[i3].UserPoolSelector, - To: reference.To{ - List: &v1beta14.UserPoolDomainList{}, - Managed: &v1beta14.UserPoolDomain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolDomain", + + "UserPoolDomainList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CognitoConfig[i3].UserPool), + Extract: resource.ExtractParamPath("user_pool_id", false), + Reference: mg.Spec.ForProvider.CognitoConfig[i3].UserPoolRef, + Selector: mg.Spec.ForProvider.CognitoConfig[i3].UserPoolSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CognitoConfig[i3].UserPool") } @@ -1052,16 +1584,26 @@ func (mg *Workforce) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.CognitoConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CognitoConfig[i3].ClientID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.CognitoConfig[i3].ClientIDRef, - Selector: mg.Spec.InitProvider.CognitoConfig[i3].ClientIDSelector, - To: reference.To{ - List: &v1beta14.UserPoolClientList{}, - Managed: &v1beta14.UserPoolClient{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CognitoConfig[i3].ClientID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.CognitoConfig[i3].ClientIDRef, + Selector: mg.Spec.InitProvider.CognitoConfig[i3].ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CognitoConfig[i3].ClientID") } @@ -1070,16 +1612,26 @@ func (mg *Workforce) ResolveReferences(ctx context.Context, c client.Reader) err } for i3 := 0; i3 < len(mg.Spec.InitProvider.CognitoConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CognitoConfig[i3].UserPool), - Extract: resource.ExtractParamPath("user_pool_id", false), - Reference: mg.Spec.InitProvider.CognitoConfig[i3].UserPoolRef, - Selector: mg.Spec.InitProvider.CognitoConfig[i3].UserPoolSelector, - To: reference.To{ - List: &v1beta14.UserPoolDomainList{}, - Managed: &v1beta14.UserPoolDomain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolDomain", + + "UserPoolDomainList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CognitoConfig[i3].UserPool), + Extract: resource.ExtractParamPath("user_pool_id", false), + Reference: mg.Spec.InitProvider.CognitoConfig[i3].UserPoolRef, + Selector: mg.Spec.InitProvider.CognitoConfig[i3].UserPoolSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CognitoConfig[i3].UserPool") } @@ -1093,6 +1645,9 @@ func (mg *Workforce) ResolveReferences(ctx context.Context, c client.Reader) err // ResolveReferences of this Workteam. func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -1100,16 +1655,26 @@ func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) erro for i3 := 0; i3 < len(mg.Spec.ForProvider.MemberDefinition); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientIDRef, - Selector: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientIDSelector, - To: reference.To{ - List: &v1beta14.UserPoolClientList{}, - Managed: &v1beta14.UserPoolClient{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientIDRef, + Selector: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientID") } @@ -1120,16 +1685,27 @@ func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.MemberDefinition); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroup), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroupRef, - Selector: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroupSelector, - To: reference.To{ - List: &v1beta14.UserGroupList{}, - Managed: &v1beta14.UserGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserGroup", + + "UserGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroup), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroupRef, + Selector: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroup") } @@ -1140,16 +1716,26 @@ func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.MemberDefinition); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPool), - Extract: resource.ExtractParamPath("user_pool_id", false), - Reference: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPoolRef, - Selector: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPoolSelector, - To: reference.To{ - List: &v1beta14.UserPoolDomainList{}, - Managed: &v1beta14.UserPoolDomain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolDomain", + + "UserPoolDomainList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPool), + Extract: resource.ExtractParamPath("user_pool_id", false), + Reference: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPoolRef, + Selector: mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPoolSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPool") } @@ -1158,16 +1744,27 @@ func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) erro } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkforceName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WorkforceNameRef, - Selector: mg.Spec.ForProvider.WorkforceNameSelector, - To: reference.To{ - List: &WorkforceList{}, - Managed: &Workforce{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "Workforce", + + "WorkforceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkforceName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WorkforceNameRef, + Selector: mg.Spec.ForProvider.WorkforceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WorkforceName") } @@ -1176,16 +1773,26 @@ func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) erro for i3 := 0; i3 < len(mg.Spec.InitProvider.MemberDefinition); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientIDRef, - Selector: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientIDSelector, - To: reference.To{ - List: &v1beta14.UserPoolClientList{}, - Managed: &v1beta14.UserPoolClient{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolClient", + + "UserPoolClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientIDRef, + Selector: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].ClientID") } @@ -1196,16 +1803,27 @@ func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.MemberDefinition); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroup), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroupRef, - Selector: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroupSelector, - To: reference.To{ - List: &v1beta14.UserGroupList{}, - Managed: &v1beta14.UserGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserGroup", + + "UserGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroup), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroupRef, + Selector: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserGroup") } @@ -1216,16 +1834,26 @@ func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.MemberDefinition); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPool), - Extract: resource.ExtractParamPath("user_pool_id", false), - Reference: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPoolRef, - Selector: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPoolSelector, - To: reference.To{ - List: &v1beta14.UserPoolDomainList{}, - Managed: &v1beta14.UserPoolDomain{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("cognitoidp.aws.upbound.io", + + "v1beta1", + + "UserPoolDomain", + + "UserPoolDomainList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPool), + Extract: resource.ExtractParamPath("user_pool_id", false), + Reference: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPoolRef, + Selector: mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPoolSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MemberDefinition[i3].CognitoMemberDefinition[i4].UserPool") } @@ -1234,16 +1862,27 @@ func (mg *Workteam) ResolveReferences(ctx context.Context, c client.Reader) erro } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkforceName), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.WorkforceNameRef, - Selector: mg.Spec.InitProvider.WorkforceNameSelector, - To: reference.To{ - List: &WorkforceList{}, - Managed: &Workforce{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sagemaker.aws.upbound.io", + + "v1beta1", + + "Workforce", + + "WorkforceList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkforceName), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.WorkforceNameRef, + Selector: mg.Spec.InitProvider.WorkforceNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WorkforceName") } diff --git a/apis/scheduler/v1beta1/zz_generated.resolvers.go b/apis/scheduler/v1beta1/zz_generated.resolvers.go index 585b8afa62..79a93a5323 100644 --- a/apis/scheduler/v1beta1/zz_generated.resolvers.go +++ b/apis/scheduler/v1beta1/zz_generated.resolvers.go @@ -10,29 +10,41 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta12 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/sqs/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Schedule. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Schedule. func (mg *Schedule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyArnRef, - Selector: mg.Spec.ForProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyArnRef, + Selector: mg.Spec.ForProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyArn") } @@ -40,16 +52,26 @@ func (mg *Schedule) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.KMSKeyArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.Target); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target[i3].Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Target[i3].ArnRef, - Selector: mg.Spec.ForProvider.Target[i3].ArnSelector, - To: reference.To{ - List: &v1beta11.QueueList{}, - Managed: &v1beta11.Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target[i3].Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Target[i3].ArnRef, + Selector: mg.Spec.ForProvider.Target[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Target[i3].Arn") } @@ -58,16 +80,27 @@ func (mg *Schedule) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.ForProvider.Target); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Target[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.Target[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Target[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Target[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.Target[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Target[i3].RoleArn") } @@ -75,16 +108,25 @@ func (mg *Schedule) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.ForProvider.Target[i3].RoleArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyArnRef, - Selector: mg.Spec.InitProvider.KMSKeyArnSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyArn), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyArnRef, + Selector: mg.Spec.InitProvider.KMSKeyArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyArn") } @@ -92,16 +134,26 @@ func (mg *Schedule) ResolveReferences(ctx context.Context, c client.Reader) erro mg.Spec.InitProvider.KMSKeyArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.Target); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target[i3].Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Target[i3].ArnRef, - Selector: mg.Spec.InitProvider.Target[i3].ArnSelector, - To: reference.To{ - List: &v1beta11.QueueList{}, - Managed: &v1beta11.Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target[i3].Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Target[i3].ArnRef, + Selector: mg.Spec.InitProvider.Target[i3].ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Target[i3].Arn") } @@ -110,16 +162,27 @@ func (mg *Schedule) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.Target); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Target[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.Target[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta12.RoleList{}, - Managed: &v1beta12.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Target[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Target[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.Target[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Target[i3].RoleArn") } diff --git a/apis/schemas/v1beta1/zz_generated.resolvers.go b/apis/schemas/v1beta1/zz_generated.resolvers.go index 82ae6718e5..ca3af9d31a 100644 --- a/apis/schemas/v1beta1/zz_generated.resolvers.go +++ b/apis/schemas/v1beta1/zz_generated.resolvers.go @@ -10,43 +10,67 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Discoverer. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Discoverer. func (mg *Discoverer) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SourceArnRef, - Selector: mg.Spec.ForProvider.SourceArnSelector, - To: reference.To{ - List: &v1beta1.BusList{}, - Managed: &v1beta1.Bus{}, - }, - }) + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SourceArnRef, + Selector: mg.Spec.ForProvider.SourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SourceArn") } mg.Spec.ForProvider.SourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SourceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("cloudwatchevents.aws.upbound.io", + + "v1beta1", + "Bus", + + "BusList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SourceArnRef, - Selector: mg.Spec.InitProvider.SourceArnSelector, - To: reference.To{ - List: &v1beta1.BusList{}, - Managed: &v1beta1.Bus{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SourceArnRef, + Selector: mg.Spec.InitProvider.SourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SourceArn") } @@ -58,37 +82,58 @@ func (mg *Discoverer) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Schema. func (mg *Schema) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("schemas.aws.upbound.io", + + "v1beta1", + + "Registry", + "RegistryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegistryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.RegistryNameRef, - Selector: mg.Spec.ForProvider.RegistryNameSelector, - To: reference.To{ - List: &RegistryList{}, - Managed: &Registry{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegistryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RegistryNameRef, + Selector: mg.Spec.ForProvider.RegistryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RegistryName") } mg.Spec.ForProvider.RegistryName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RegistryNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("schemas.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegistryName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.RegistryNameRef, - Selector: mg.Spec.InitProvider.RegistryNameSelector, - To: reference.To{ - List: &RegistryList{}, - Managed: &Registry{}, - }, - }) + "Registry", + "RegistryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegistryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RegistryNameRef, + Selector: mg.Spec.InitProvider.RegistryNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RegistryName") } diff --git a/apis/secretsmanager/v1beta1/zz_generated.resolvers.go b/apis/secretsmanager/v1beta1/zz_generated.resolvers.go index 3ddc90bd87..981bfa4cab 100644 --- a/apis/secretsmanager/v1beta1/zz_generated.resolvers.go +++ b/apis/secretsmanager/v1beta1/zz_generated.resolvers.go @@ -10,44 +10,65 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/lambda/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Secret. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Secret. func (mg *Secret) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -59,37 +80,56 @@ func (mg *Secret) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this SecretPolicy. func (mg *SecretPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecretArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SecretArnRef, - Selector: mg.Spec.ForProvider.SecretArnSelector, - To: reference.To{ - List: &SecretList{}, - Managed: &Secret{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecretArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SecretArnRef, + Selector: mg.Spec.ForProvider.SecretArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecretArn") } mg.Spec.ForProvider.SecretArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecretArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecretArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SecretArnRef, - Selector: mg.Spec.InitProvider.SecretArnSelector, - To: reference.To{ - List: &SecretList{}, - Managed: &Secret{}, - }, - }) + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecretArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SecretArnRef, + Selector: mg.Spec.InitProvider.SecretArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecretArn") } @@ -101,69 +141,106 @@ func (mg *SecretPolicy) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this SecretRotation. func (mg *SecretRotation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RotationLambdaArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.RotationLambdaArnRef, - Selector: mg.Spec.ForProvider.RotationLambdaArnSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RotationLambdaArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.RotationLambdaArnRef, + Selector: mg.Spec.ForProvider.RotationLambdaArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RotationLambdaArn") } mg.Spec.ForProvider.RotationLambdaArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RotationLambdaArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecretID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SecretIDRef, - Selector: mg.Spec.ForProvider.SecretIDSelector, - To: reference.To{ - List: &SecretList{}, - Managed: &Secret{}, - }, - }) + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecretID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SecretIDRef, + Selector: mg.Spec.ForProvider.SecretIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecretID") } mg.Spec.ForProvider.SecretID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecretIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RotationLambdaArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.RotationLambdaArnRef, - Selector: mg.Spec.InitProvider.RotationLambdaArnSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RotationLambdaArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.RotationLambdaArnRef, + Selector: mg.Spec.InitProvider.RotationLambdaArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RotationLambdaArn") } mg.Spec.InitProvider.RotationLambdaArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RotationLambdaArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecretID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SecretIDRef, - Selector: mg.Spec.InitProvider.SecretIDSelector, - To: reference.To{ - List: &SecretList{}, - Managed: &Secret{}, - }, - }) + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecretID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SecretIDRef, + Selector: mg.Spec.InitProvider.SecretIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecretID") } @@ -175,37 +252,56 @@ func (mg *SecretRotation) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this SecretVersion. func (mg *SecretVersion) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", + + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecretID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.SecretIDRef, - Selector: mg.Spec.ForProvider.SecretIDSelector, - To: reference.To{ - List: &SecretList{}, - Managed: &Secret{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecretID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.SecretIDRef, + Selector: mg.Spec.ForProvider.SecretIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SecretID") } mg.Spec.ForProvider.SecretID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecretIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("secretsmanager.aws.upbound.io", + + "v1beta1", + "Secret", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecretID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.SecretIDRef, - Selector: mg.Spec.InitProvider.SecretIDSelector, - To: reference.To{ - List: &SecretList{}, - Managed: &Secret{}, - }, - }) + "SecretList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecretID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.SecretIDRef, + Selector: mg.Spec.InitProvider.SecretIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SecretID") } diff --git a/apis/securityhub/v1beta1/zz_generated.resolvers.go b/apis/securityhub/v1beta1/zz_generated.resolvers.go index 4108fb9020..a99a5cfba2 100644 --- a/apis/securityhub/v1beta1/zz_generated.resolvers.go +++ b/apis/securityhub/v1beta1/zz_generated.resolvers.go @@ -10,42 +10,66 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this InviteAccepter. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this InviteAccepter. func (mg *InviteAccepter) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("securityhub.aws.upbound.io", + + "v1beta1", + + "Member", + "MemberList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MasterID), - Extract: resource.ExtractParamPath("master_id", true), - Reference: mg.Spec.ForProvider.MasterIDRef, - Selector: mg.Spec.ForProvider.MasterIDSelector, - To: reference.To{ - List: &MemberList{}, - Managed: &Member{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MasterID), + Extract: resource.ExtractParamPath("master_id", true), + Reference: mg.Spec.ForProvider.MasterIDRef, + Selector: mg.Spec.ForProvider.MasterIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.MasterID") } mg.Spec.ForProvider.MasterID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.MasterIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("securityhub.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MasterID), - Extract: resource.ExtractParamPath("master_id", true), - Reference: mg.Spec.InitProvider.MasterIDRef, - Selector: mg.Spec.InitProvider.MasterIDSelector, - To: reference.To{ - List: &MemberList{}, - Managed: &Member{}, - }, - }) + "Member", + "MemberList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.MasterID), + Extract: resource.ExtractParamPath("master_id", true), + Reference: mg.Spec.InitProvider.MasterIDRef, + Selector: mg.Spec.InitProvider.MasterIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.MasterID") } diff --git a/apis/servicecatalog/v1beta1/zz_generated.resolvers.go b/apis/servicecatalog/v1beta1/zz_generated.resolvers.go index cb7060dd80..569884138d 100644 --- a/apis/servicecatalog/v1beta1/zz_generated.resolvers.go +++ b/apis/servicecatalog/v1beta1/zz_generated.resolvers.go @@ -10,77 +10,116 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/budgets/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this BudgetResourceAssociation. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this BudgetResourceAssociation. func (mg *BudgetResourceAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BudgetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.BudgetNameRef, - Selector: mg.Spec.ForProvider.BudgetNameSelector, - To: reference.To{ - List: &v1beta1.BudgetList{}, - Managed: &v1beta1.Budget{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("budgets.aws.upbound.io", + + "v1beta1", + + "Budget", + "BudgetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BudgetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.BudgetNameRef, + Selector: mg.Spec.ForProvider.BudgetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BudgetName") } mg.Spec.ForProvider.BudgetName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BudgetNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BudgetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.BudgetNameRef, - Selector: mg.Spec.InitProvider.BudgetNameSelector, - To: reference.To{ - List: &v1beta1.BudgetList{}, - Managed: &v1beta1.Budget{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("budgets.aws.upbound.io", + + "v1beta1", + + "Budget", + "BudgetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BudgetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.BudgetNameRef, + Selector: mg.Spec.InitProvider.BudgetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BudgetName") } mg.Spec.InitProvider.BudgetName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BudgetNameRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ResourceIDRef, - Selector: mg.Spec.InitProvider.ResourceIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ResourceIDRef, + Selector: mg.Spec.InitProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceID") } @@ -92,69 +131,104 @@ func (mg *BudgetResourceAssociation) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this Constraint. func (mg *Constraint) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PortfolioID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PortfolioIDRef, - Selector: mg.Spec.ForProvider.PortfolioIDSelector, - To: reference.To{ - List: &PortfolioList{}, - Managed: &Portfolio{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Portfolio", + + "PortfolioList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PortfolioID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PortfolioIDRef, + Selector: mg.Spec.ForProvider.PortfolioIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PortfolioID") } mg.Spec.ForProvider.PortfolioID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PortfolioIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProductID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ProductIDRef, - Selector: mg.Spec.ForProvider.ProductIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProductID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ProductIDRef, + Selector: mg.Spec.ForProvider.ProductIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProductID") } mg.Spec.ForProvider.ProductID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProductIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PortfolioID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PortfolioIDRef, - Selector: mg.Spec.InitProvider.PortfolioIDSelector, - To: reference.To{ - List: &PortfolioList{}, - Managed: &Portfolio{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Portfolio", + + "PortfolioList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PortfolioID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PortfolioIDRef, + Selector: mg.Spec.InitProvider.PortfolioIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PortfolioID") } mg.Spec.InitProvider.PortfolioID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PortfolioIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProductID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ProductIDRef, - Selector: mg.Spec.InitProvider.ProductIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProductID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ProductIDRef, + Selector: mg.Spec.InitProvider.ProductIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProductID") } @@ -166,37 +240,56 @@ func (mg *Constraint) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this PortfolioShare. func (mg *PortfolioShare) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PortfolioID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.PortfolioIDRef, - Selector: mg.Spec.ForProvider.PortfolioIDSelector, - To: reference.To{ - List: &PortfolioList{}, - Managed: &Portfolio{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Portfolio", + + "PortfolioList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PortfolioID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.PortfolioIDRef, + Selector: mg.Spec.ForProvider.PortfolioIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PortfolioID") } mg.Spec.ForProvider.PortfolioID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PortfolioIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PortfolioID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.PortfolioIDRef, - Selector: mg.Spec.InitProvider.PortfolioIDSelector, - To: reference.To{ - List: &PortfolioList{}, - Managed: &Portfolio{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Portfolio", + + "PortfolioList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PortfolioID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.PortfolioIDRef, + Selector: mg.Spec.InitProvider.PortfolioIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PortfolioID") } @@ -208,69 +301,108 @@ func (mg *PortfolioShare) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this PrincipalPortfolioAssociation. func (mg *PrincipalPortfolioAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PortfolioID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PortfolioIDRef, - Selector: mg.Spec.ForProvider.PortfolioIDSelector, - To: reference.To{ - List: &PortfolioList{}, - Managed: &Portfolio{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Portfolio", + + "PortfolioList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PortfolioID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PortfolioIDRef, + Selector: mg.Spec.ForProvider.PortfolioIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PortfolioID") } mg.Spec.ForProvider.PortfolioID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PortfolioIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrincipalArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.PrincipalArnRef, - Selector: mg.Spec.ForProvider.PrincipalArnSelector, - To: reference.To{ - List: &v1beta11.UserList{}, - Managed: &v1beta11.User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrincipalArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.PrincipalArnRef, + Selector: mg.Spec.ForProvider.PrincipalArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrincipalArn") } mg.Spec.ForProvider.PrincipalArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PrincipalArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PortfolioID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PortfolioIDRef, - Selector: mg.Spec.InitProvider.PortfolioIDSelector, - To: reference.To{ - List: &PortfolioList{}, - Managed: &Portfolio{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Portfolio", + + "PortfolioList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PortfolioID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PortfolioIDRef, + Selector: mg.Spec.InitProvider.PortfolioIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PortfolioID") } mg.Spec.InitProvider.PortfolioID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PortfolioIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrincipalArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.PrincipalArnRef, - Selector: mg.Spec.InitProvider.PrincipalArnSelector, - To: reference.To{ - List: &v1beta11.UserList{}, - Managed: &v1beta11.User{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PrincipalArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.PrincipalArnRef, + Selector: mg.Spec.InitProvider.PrincipalArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PrincipalArn") } @@ -282,69 +414,104 @@ func (mg *PrincipalPortfolioAssociation) ResolveReferences(ctx context.Context, // ResolveReferences of this ProductPortfolioAssociation. func (mg *ProductPortfolioAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PortfolioID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PortfolioIDRef, - Selector: mg.Spec.ForProvider.PortfolioIDSelector, - To: reference.To{ - List: &PortfolioList{}, - Managed: &Portfolio{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Portfolio", + + "PortfolioList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PortfolioID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PortfolioIDRef, + Selector: mg.Spec.ForProvider.PortfolioIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PortfolioID") } mg.Spec.ForProvider.PortfolioID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PortfolioIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProductID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ProductIDRef, - Selector: mg.Spec.ForProvider.ProductIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProductID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ProductIDRef, + Selector: mg.Spec.ForProvider.ProductIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProductID") } mg.Spec.ForProvider.ProductID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProductIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PortfolioID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PortfolioIDRef, - Selector: mg.Spec.InitProvider.PortfolioIDSelector, - To: reference.To{ - List: &PortfolioList{}, - Managed: &Portfolio{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Portfolio", + + "PortfolioList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PortfolioID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PortfolioIDRef, + Selector: mg.Spec.InitProvider.PortfolioIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PortfolioID") } mg.Spec.InitProvider.PortfolioID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PortfolioIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProductID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ProductIDRef, - Selector: mg.Spec.InitProvider.ProductIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProductID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ProductIDRef, + Selector: mg.Spec.InitProvider.ProductIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProductID") } @@ -356,37 +523,56 @@ func (mg *ProductPortfolioAssociation) ResolveReferences(ctx context.Context, c // ResolveReferences of this ProvisioningArtifact. func (mg *ProvisioningArtifact) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProductID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ProductIDRef, - Selector: mg.Spec.ForProvider.ProductIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProductID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ProductIDRef, + Selector: mg.Spec.ForProvider.ProductIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProductID") } mg.Spec.ForProvider.ProductID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProductIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProductID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ProductIDRef, - Selector: mg.Spec.InitProvider.ProductIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProductID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ProductIDRef, + Selector: mg.Spec.InitProvider.ProductIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProductID") } @@ -398,69 +584,104 @@ func (mg *ProvisioningArtifact) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this TagOptionResourceAssociation. func (mg *TagOptionResourceAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ResourceIDRef, - Selector: mg.Spec.ForProvider.ResourceIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ResourceIDRef, + Selector: mg.Spec.ForProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceID") } mg.Spec.ForProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TagOptionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.TagOptionIDRef, - Selector: mg.Spec.ForProvider.TagOptionIDSelector, - To: reference.To{ - List: &TagOptionList{}, - Managed: &TagOption{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "TagOption", + + "TagOptionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TagOptionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.TagOptionIDRef, + Selector: mg.Spec.ForProvider.TagOptionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TagOptionID") } mg.Spec.ForProvider.TagOptionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TagOptionIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ResourceIDRef, - Selector: mg.Spec.InitProvider.ResourceIDSelector, - To: reference.To{ - List: &ProductList{}, - Managed: &Product{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "Product", + + "ProductList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ResourceIDRef, + Selector: mg.Spec.InitProvider.ResourceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceID") } mg.Spec.InitProvider.ResourceID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ResourceIDRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TagOptionID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.TagOptionIDRef, - Selector: mg.Spec.InitProvider.TagOptionIDSelector, - To: reference.To{ - List: &TagOptionList{}, - Managed: &TagOption{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicecatalog.aws.upbound.io", + + "v1beta1", + "TagOption", + + "TagOptionList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TagOptionID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.TagOptionIDRef, + Selector: mg.Spec.InitProvider.TagOptionIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TagOptionID") } diff --git a/apis/servicediscovery/v1beta1/zz_generated.resolvers.go b/apis/servicediscovery/v1beta1/zz_generated.resolvers.go index 40ba98f639..9b4cd47705 100644 --- a/apis/servicediscovery/v1beta1/zz_generated.resolvers.go +++ b/apis/servicediscovery/v1beta1/zz_generated.resolvers.go @@ -10,43 +10,65 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this PrivateDNSNamespace. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this PrivateDNSNamespace. func (mg *PrivateDNSNamespace) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPC), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.VPCRef, - Selector: mg.Spec.ForProvider.VPCSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPC), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCRef, + Selector: mg.Spec.ForProvider.VPCSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.VPC") } mg.Spec.ForProvider.VPC = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.VPCRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPC), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.VPCRef, - Selector: mg.Spec.InitProvider.VPCSelector, - To: reference.To{ - List: &v1beta1.VPCList{}, - Managed: &v1beta1.VPC{}, - }, - }) + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPC), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCRef, + Selector: mg.Spec.InitProvider.VPCSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.VPC") } @@ -58,22 +80,34 @@ func (mg *PrivateDNSNamespace) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this Service. func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.DNSConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DNSConfig[i3].NamespaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DNSConfig[i3].NamespaceIDRef, - Selector: mg.Spec.ForProvider.DNSConfig[i3].NamespaceIDSelector, - To: reference.To{ - List: &PrivateDNSNamespaceList{}, - Managed: &PrivateDNSNamespace{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicediscovery.aws.upbound.io", + + "v1beta1", + "PrivateDNSNamespace", + + "PrivateDNSNamespaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DNSConfig[i3].NamespaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DNSConfig[i3].NamespaceIDRef, + Selector: mg.Spec.ForProvider.DNSConfig[i3].NamespaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DNSConfig[i3].NamespaceID") } @@ -82,16 +116,25 @@ func (mg *Service) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.DNSConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DNSConfig[i3].NamespaceID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DNSConfig[i3].NamespaceIDRef, - Selector: mg.Spec.InitProvider.DNSConfig[i3].NamespaceIDSelector, - To: reference.To{ - List: &PrivateDNSNamespaceList{}, - Managed: &PrivateDNSNamespace{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("servicediscovery.aws.upbound.io", + + "v1beta1", + "PrivateDNSNamespace", + + "PrivateDNSNamespaceList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DNSConfig[i3].NamespaceID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DNSConfig[i3].NamespaceIDRef, + Selector: mg.Spec.InitProvider.DNSConfig[i3].NamespaceIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DNSConfig[i3].NamespaceID") } diff --git a/apis/ses/v1beta1/zz_generated.resolvers.go b/apis/ses/v1beta1/zz_generated.resolvers.go index 0340a1a7c7..e67c2fd801 100644 --- a/apis/ses/v1beta1/zz_generated.resolvers.go +++ b/apis/ses/v1beta1/zz_generated.resolvers.go @@ -10,45 +10,69 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/firehose/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this DomainMailFrom. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this DomainMailFrom. func (mg *DomainMailFrom) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ses.aws.upbound.io", + + "v1beta1", + + "DomainIdentity", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Domain), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DomainRef, - Selector: mg.Spec.ForProvider.DomainSelector, - To: reference.To{ - List: &DomainIdentityList{}, - Managed: &DomainIdentity{}, - }, - }) + "DomainIdentityList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Domain), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DomainRef, + Selector: mg.Spec.ForProvider.DomainSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Domain") } mg.Spec.ForProvider.Domain = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DomainRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ses.aws.upbound.io", + + "v1beta1", + + "DomainIdentity", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Domain), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.DomainRef, - Selector: mg.Spec.InitProvider.DomainSelector, - To: reference.To{ - List: &DomainIdentityList{}, - Managed: &DomainIdentity{}, - }, - }) + "DomainIdentityList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Domain), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.DomainRef, + Selector: mg.Spec.InitProvider.DomainSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Domain") } @@ -60,21 +84,34 @@ func (mg *DomainMailFrom) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this EventDestination. func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ses.aws.upbound.io", + + "v1beta1", + + "ConfigurationSet", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationSetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ConfigurationSetNameRef, - Selector: mg.Spec.ForProvider.ConfigurationSetNameSelector, - To: reference.To{ - List: &ConfigurationSetList{}, - Managed: &ConfigurationSet{}, - }, - }) + "ConfigurationSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationSetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ConfigurationSetNameRef, + Selector: mg.Spec.ForProvider.ConfigurationSetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationSetName") } @@ -82,16 +119,27 @@ func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Read mg.Spec.ForProvider.ConfigurationSetNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.KinesisDestination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KinesisDestination[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.KinesisDestination[i3].RoleArnRef, - Selector: mg.Spec.ForProvider.KinesisDestination[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KinesisDestination[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.KinesisDestination[i3].RoleArnRef, + Selector: mg.Spec.ForProvider.KinesisDestination[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KinesisDestination[i3].RoleArn") } @@ -100,16 +148,26 @@ func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.ForProvider.KinesisDestination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KinesisDestination[i3].StreamArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.KinesisDestination[i3].StreamArnRef, - Selector: mg.Spec.ForProvider.KinesisDestination[i3].StreamArnSelector, - To: reference.To{ - List: &v1beta11.DeliveryStreamList{}, - Managed: &v1beta11.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KinesisDestination[i3].StreamArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.KinesisDestination[i3].StreamArnRef, + Selector: mg.Spec.ForProvider.KinesisDestination[i3].StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KinesisDestination[i3].StreamArn") } @@ -118,16 +176,26 @@ func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.ForProvider.SnsDestination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsDestination[i3].TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.SnsDestination[i3].TopicArnRef, - Selector: mg.Spec.ForProvider.SnsDestination[i3].TopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SnsDestination[i3].TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.SnsDestination[i3].TopicArnRef, + Selector: mg.Spec.ForProvider.SnsDestination[i3].TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SnsDestination[i3].TopicArn") } @@ -135,16 +203,27 @@ func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Read mg.Spec.ForProvider.SnsDestination[i3].TopicArnRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationSetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ConfigurationSetNameRef, - Selector: mg.Spec.InitProvider.ConfigurationSetNameSelector, - To: reference.To{ - List: &ConfigurationSetList{}, - Managed: &ConfigurationSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ses.aws.upbound.io", + + "v1beta1", + + "ConfigurationSet", + + "ConfigurationSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationSetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ConfigurationSetNameRef, + Selector: mg.Spec.InitProvider.ConfigurationSetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConfigurationSetName") } @@ -152,16 +231,27 @@ func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Read mg.Spec.InitProvider.ConfigurationSetNameRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.KinesisDestination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KinesisDestination[i3].RoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.KinesisDestination[i3].RoleArnRef, - Selector: mg.Spec.InitProvider.KinesisDestination[i3].RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KinesisDestination[i3].RoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.KinesisDestination[i3].RoleArnRef, + Selector: mg.Spec.InitProvider.KinesisDestination[i3].RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KinesisDestination[i3].RoleArn") } @@ -170,16 +260,26 @@ func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.InitProvider.KinesisDestination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KinesisDestination[i3].StreamArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.KinesisDestination[i3].StreamArnRef, - Selector: mg.Spec.InitProvider.KinesisDestination[i3].StreamArnSelector, - To: reference.To{ - List: &v1beta11.DeliveryStreamList{}, - Managed: &v1beta11.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KinesisDestination[i3].StreamArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.KinesisDestination[i3].StreamArnRef, + Selector: mg.Spec.InitProvider.KinesisDestination[i3].StreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KinesisDestination[i3].StreamArn") } @@ -188,16 +288,26 @@ func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.InitProvider.SnsDestination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsDestination[i3].TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.SnsDestination[i3].TopicArnRef, - Selector: mg.Spec.InitProvider.SnsDestination[i3].TopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SnsDestination[i3].TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.SnsDestination[i3].TopicArnRef, + Selector: mg.Spec.InitProvider.SnsDestination[i3].TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SnsDestination[i3].TopicArn") } @@ -211,69 +321,110 @@ func (mg *EventDestination) ResolveReferences(ctx context.Context, c client.Read // ResolveReferences of this IdentityNotificationTopic. func (mg *IdentityNotificationTopic) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ses.aws.upbound.io", + + "v1beta1", + + "DomainIdentity", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Identity), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.IdentityRef, - Selector: mg.Spec.ForProvider.IdentitySelector, - To: reference.To{ - List: &DomainIdentityList{}, - Managed: &DomainIdentity{}, - }, - }) + "DomainIdentityList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Identity), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.IdentityRef, + Selector: mg.Spec.ForProvider.IdentitySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Identity") } mg.Spec.ForProvider.Identity = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IdentityRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TopicArnRef, - Selector: mg.Spec.ForProvider.TopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TopicArnRef, + Selector: mg.Spec.ForProvider.TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TopicArn") } mg.Spec.ForProvider.TopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TopicArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ses.aws.upbound.io", + + "v1beta1", + + "DomainIdentity", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Identity), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.IdentityRef, - Selector: mg.Spec.InitProvider.IdentitySelector, - To: reference.To{ - List: &DomainIdentityList{}, - Managed: &DomainIdentity{}, - }, - }) + "DomainIdentityList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Identity), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.IdentityRef, + Selector: mg.Spec.InitProvider.IdentitySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Identity") } mg.Spec.InitProvider.Identity = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.IdentityRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TopicArnRef, - Selector: mg.Spec.InitProvider.TopicArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TopicArnRef, + Selector: mg.Spec.InitProvider.TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TopicArn") } @@ -285,37 +436,60 @@ func (mg *IdentityNotificationTopic) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this IdentityPolicy. func (mg *IdentityPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ses.aws.upbound.io", + + "v1beta1", + + "DomainIdentity", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Identity), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.IdentityRef, - Selector: mg.Spec.ForProvider.IdentitySelector, - To: reference.To{ - List: &DomainIdentityList{}, - Managed: &DomainIdentity{}, - }, - }) + "DomainIdentityList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Identity), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.IdentityRef, + Selector: mg.Spec.ForProvider.IdentitySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Identity") } mg.Spec.ForProvider.Identity = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IdentityRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ses.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Identity), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.IdentityRef, - Selector: mg.Spec.InitProvider.IdentitySelector, - To: reference.To{ - List: &DomainIdentityList{}, - Managed: &DomainIdentity{}, - }, - }) + "DomainIdentity", + + "DomainIdentityList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Identity), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.IdentityRef, + Selector: mg.Spec.InitProvider.IdentitySelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Identity") } diff --git a/apis/sesv2/v1beta1/zz_generated.resolvers.go b/apis/sesv2/v1beta1/zz_generated.resolvers.go index 1fabdd3100..4329395f3a 100644 --- a/apis/sesv2/v1beta1/zz_generated.resolvers.go +++ b/apis/sesv2/v1beta1/zz_generated.resolvers.go @@ -10,30 +10,42 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/firehose/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/pinpoint/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this ConfigurationSetEventDestination. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this ConfigurationSetEventDestination. func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sesv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationSetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ConfigurationSetNameRef, - Selector: mg.Spec.ForProvider.ConfigurationSetNameSelector, - To: reference.To{ - List: &ConfigurationSetList{}, - Managed: &ConfigurationSet{}, - }, - }) + "ConfigurationSet", + + "ConfigurationSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationSetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ConfigurationSetNameRef, + Selector: mg.Spec.ForProvider.ConfigurationSetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationSetName") } @@ -42,16 +54,26 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex for i3 := 0; i3 < len(mg.Spec.ForProvider.EventDestination); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArnRef, - Selector: mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArnSelector, - To: reference.To{ - List: &v1beta1.DeliveryStreamList{}, - Managed: &v1beta1.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArnRef, + Selector: mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArn") } @@ -62,16 +84,27 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex } for i3 := 0; i3 < len(mg.Spec.ForProvider.EventDestination); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArnRef, - Selector: mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArnRef, + Selector: mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArn") } @@ -82,16 +115,26 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex } for i3 := 0; i3 < len(mg.Spec.ForProvider.EventDestination); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.EventDestination[i3].PinpointDestination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArnRef, - Selector: mg.Spec.ForProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArnSelector, - To: reference.To{ - List: &v1beta12.AppList{}, - Managed: &v1beta12.App{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("pinpoint.aws.upbound.io", + + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArnRef, + Selector: mg.Spec.ForProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArn") } @@ -102,16 +145,26 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex } for i3 := 0; i3 < len(mg.Spec.ForProvider.EventDestination); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.EventDestination[i3].SnsDestination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventDestination[i3].SnsDestination[i4].TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.EventDestination[i3].SnsDestination[i4].TopicArnRef, - Selector: mg.Spec.ForProvider.EventDestination[i3].SnsDestination[i4].TopicArnSelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EventDestination[i3].SnsDestination[i4].TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.EventDestination[i3].SnsDestination[i4].TopicArnRef, + Selector: mg.Spec.ForProvider.EventDestination[i3].SnsDestination[i4].TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EventDestination[i3].SnsDestination[i4].TopicArn") } @@ -120,16 +173,26 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationSetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ConfigurationSetNameRef, - Selector: mg.Spec.InitProvider.ConfigurationSetNameSelector, - To: reference.To{ - List: &ConfigurationSetList{}, - Managed: &ConfigurationSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sesv2.aws.upbound.io", + + "v1beta1", + + "ConfigurationSet", + + "ConfigurationSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationSetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ConfigurationSetNameRef, + Selector: mg.Spec.InitProvider.ConfigurationSetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConfigurationSetName") } @@ -138,16 +201,26 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex for i3 := 0; i3 < len(mg.Spec.InitProvider.EventDestination); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArn), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArnRef, - Selector: mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArnSelector, - To: reference.To{ - List: &v1beta1.DeliveryStreamList{}, - Managed: &v1beta1.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArn), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArnRef, + Selector: mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].DeliveryStreamArn") } @@ -158,16 +231,27 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex } for i3 := 0; i3 < len(mg.Spec.InitProvider.EventDestination); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArnRef, - Selector: mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArnSelector, - To: reference.To{ - List: &v1beta11.RoleList{}, - Managed: &v1beta11.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArnRef, + Selector: mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventDestination[i3].KinesisFirehoseDestination[i4].IAMRoleArn") } @@ -178,16 +262,26 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex } for i3 := 0; i3 < len(mg.Spec.InitProvider.EventDestination); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.EventDestination[i3].PinpointDestination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArnRef, - Selector: mg.Spec.InitProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArnSelector, - To: reference.To{ - List: &v1beta12.AppList{}, - Managed: &v1beta12.App{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("pinpoint.aws.upbound.io", + + "v1beta1", + + "App", + "AppList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArnRef, + Selector: mg.Spec.InitProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventDestination[i3].PinpointDestination[i4].ApplicationArn") } @@ -198,16 +292,26 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex } for i3 := 0; i3 < len(mg.Spec.InitProvider.EventDestination); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.EventDestination[i3].SnsDestination); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventDestination[i3].SnsDestination[i4].TopicArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.EventDestination[i3].SnsDestination[i4].TopicArnRef, - Selector: mg.Spec.InitProvider.EventDestination[i3].SnsDestination[i4].TopicArnSelector, - To: reference.To{ - List: &v1beta13.TopicList{}, - Managed: &v1beta13.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EventDestination[i3].SnsDestination[i4].TopicArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.EventDestination[i3].SnsDestination[i4].TopicArnRef, + Selector: mg.Spec.InitProvider.EventDestination[i3].SnsDestination[i4].TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EventDestination[i3].SnsDestination[i4].TopicArn") } @@ -222,37 +326,58 @@ func (mg *ConfigurationSetEventDestination) ResolveReferences(ctx context.Contex // ResolveReferences of this EmailIdentity. func (mg *EmailIdentity) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sesv2.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationSetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ConfigurationSetNameRef, - Selector: mg.Spec.ForProvider.ConfigurationSetNameSelector, - To: reference.To{ - List: &ConfigurationSetList{}, - Managed: &ConfigurationSet{}, - }, - }) + "ConfigurationSet", + + "ConfigurationSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationSetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ConfigurationSetNameRef, + Selector: mg.Spec.ForProvider.ConfigurationSetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationSetName") } mg.Spec.ForProvider.ConfigurationSetName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConfigurationSetNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sesv2.aws.upbound.io", + + "v1beta1", + + "ConfigurationSet", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationSetName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ConfigurationSetNameRef, - Selector: mg.Spec.InitProvider.ConfigurationSetNameSelector, - To: reference.To{ - List: &ConfigurationSetList{}, - Managed: &ConfigurationSet{}, - }, - }) + "ConfigurationSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ConfigurationSetName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ConfigurationSetNameRef, + Selector: mg.Spec.InitProvider.ConfigurationSetNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ConfigurationSetName") } diff --git a/apis/sfn/v1beta1/zz_generated.resolvers.go b/apis/sfn/v1beta1/zz_generated.resolvers.go index c3b99d7cf2..a41bbc6804 100644 --- a/apis/sfn/v1beta1/zz_generated.resolvers.go +++ b/apis/sfn/v1beta1/zz_generated.resolvers.go @@ -9,44 +9,70 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this StateMachine. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this StateMachine. func (mg *StateMachine) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleArnRef, - Selector: mg.Spec.ForProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleArnRef, + Selector: mg.Spec.ForProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RoleArn") } mg.Spec.ForProvider.RoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleArnRef, - Selector: mg.Spec.InitProvider.RoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleArnRef, + Selector: mg.Spec.InitProvider.RoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RoleArn") } diff --git a/apis/signer/v1beta1/zz_generated.resolvers.go b/apis/signer/v1beta1/zz_generated.resolvers.go index 6b683bc057..4ab96435aa 100644 --- a/apis/signer/v1beta1/zz_generated.resolvers.go +++ b/apis/signer/v1beta1/zz_generated.resolvers.go @@ -8,44 +8,68 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this SigningJob. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this SigningJob. func (mg *SigningJob) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("signer.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProfileName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ProfileNameRef, - Selector: mg.Spec.ForProvider.ProfileNameSelector, - To: reference.To{ - List: &SigningProfileList{}, - Managed: &SigningProfile{}, - }, - }) + "SigningProfile", + + "SigningProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProfileName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ProfileNameRef, + Selector: mg.Spec.ForProvider.ProfileNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProfileName") } mg.Spec.ForProvider.ProfileName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProfileNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("signer.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProfileName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ProfileNameRef, - Selector: mg.Spec.InitProvider.ProfileNameSelector, - To: reference.To{ - List: &SigningProfileList{}, - Managed: &SigningProfile{}, - }, - }) + "v1beta1", + + "SigningProfile", + + "SigningProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProfileName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ProfileNameRef, + Selector: mg.Spec.InitProvider.ProfileNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProfileName") } @@ -57,53 +81,83 @@ func (mg *SigningJob) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this SigningProfilePermission. func (mg *SigningProfilePermission) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("signer.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProfileName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ProfileNameRef, - Selector: mg.Spec.ForProvider.ProfileNameSelector, - To: reference.To{ - List: &SigningProfileList{}, - Managed: &SigningProfile{}, - }, - }) + "SigningProfile", + + "SigningProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProfileName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ProfileNameRef, + Selector: mg.Spec.ForProvider.ProfileNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProfileName") } mg.Spec.ForProvider.ProfileName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProfileNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("signer.aws.upbound.io", + + "v1beta1", + + "SigningProfile", + + "SigningProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProfileVersion), - Extract: resource.ExtractParamPath("version", true), - Reference: mg.Spec.ForProvider.ProfileVersionRef, - Selector: mg.Spec.ForProvider.ProfileVersionSelector, - To: reference.To{ - List: &SigningProfileList{}, - Managed: &SigningProfile{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProfileVersion), + Extract: resource.ExtractParamPath("version", true), + Reference: mg.Spec.ForProvider.ProfileVersionRef, + Selector: mg.Spec.ForProvider.ProfileVersionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ProfileVersion") } mg.Spec.ForProvider.ProfileVersion = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ProfileVersionRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("signer.aws.upbound.io", + + "v1beta1", + + "SigningProfile", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProfileVersion), - Extract: resource.ExtractParamPath("version", true), - Reference: mg.Spec.InitProvider.ProfileVersionRef, - Selector: mg.Spec.InitProvider.ProfileVersionSelector, - To: reference.To{ - List: &SigningProfileList{}, - Managed: &SigningProfile{}, - }, - }) + "SigningProfileList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ProfileVersion), + Extract: resource.ExtractParamPath("version", true), + Reference: mg.Spec.InitProvider.ProfileVersionRef, + Selector: mg.Spec.InitProvider.ProfileVersionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ProfileVersion") } diff --git a/apis/sns/v1beta1/zz_generated.resolvers.go b/apis/sns/v1beta1/zz_generated.resolvers.go index 742a9acdc6..0884ef6053 100644 --- a/apis/sns/v1beta1/zz_generated.resolvers.go +++ b/apis/sns/v1beta1/zz_generated.resolvers.go @@ -10,77 +10,122 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/sqs/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this PlatformApplication. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this PlatformApplication. func (mg *PlatformApplication) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.FailureFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.FailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.FailureFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.FailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FailureFeedbackRoleArn") } mg.Spec.ForProvider.FailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.SuccessFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.SuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.SuccessFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.SuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SuccessFeedbackRoleArn") } mg.Spec.ForProvider.SuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.FailureFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.FailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.FailureFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.FailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FailureFeedbackRoleArn") } mg.Spec.InitProvider.FailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.FailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.SuccessFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.SuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.SuccessFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.SuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SuccessFeedbackRoleArn") } @@ -92,37 +137,60 @@ func (mg *PlatformApplication) ResolveReferences(ctx context.Context, c client.R // ResolveReferences of this SMSPreferences. func (mg *SMSPreferences) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeliveryStatusIAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.DeliveryStatusIAMRoleArnRef, - Selector: mg.Spec.ForProvider.DeliveryStatusIAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DeliveryStatusIAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.DeliveryStatusIAMRoleArnRef, + Selector: mg.Spec.ForProvider.DeliveryStatusIAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DeliveryStatusIAMRoleArn") } mg.Spec.ForProvider.DeliveryStatusIAMRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DeliveryStatusIAMRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeliveryStatusIAMRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.DeliveryStatusIAMRoleArnRef, - Selector: mg.Spec.InitProvider.DeliveryStatusIAMRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DeliveryStatusIAMRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.DeliveryStatusIAMRoleArnRef, + Selector: mg.Spec.InitProvider.DeliveryStatusIAMRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DeliveryStatusIAMRoleArn") } @@ -134,325 +202,528 @@ func (mg *SMSPreferences) ResolveReferences(ctx context.Context, c client.Reader // ResolveReferences of this Topic. func (mg *Topic) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArn") } mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApplicationFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArn") } mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ApplicationSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArn") } mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FirehoseFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArn") } mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.FirehoseSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.HTTPFailureFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.HTTPFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.HTTPFailureFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.HTTPFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HTTPFailureFeedbackRoleArn") } mg.Spec.ForProvider.HTTPFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HTTPFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArn") } mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.HTTPSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaFailureFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.LambdaFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaFailureFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.LambdaFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaFailureFeedbackRoleArn") } mg.Spec.ForProvider.LambdaFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LambdaFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArn") } mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LambdaSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SqsFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.SqsFailureFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.SqsFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SqsFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.SqsFailureFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.SqsFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SqsFailureFeedbackRoleArn") } mg.Spec.ForProvider.SqsFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SqsFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SqsSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.SqsSuccessFeedbackRoleArnRef, - Selector: mg.Spec.ForProvider.SqsSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SqsSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.SqsSuccessFeedbackRoleArnRef, + Selector: mg.Spec.ForProvider.SqsSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SqsSuccessFeedbackRoleArn") } mg.Spec.ForProvider.SqsSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SqsSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArn") } mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ApplicationFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArn") } mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ApplicationSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArn") } mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.FirehoseFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArn") } mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.FirehoseSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.HTTPFailureFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.HTTPFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.HTTPFailureFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.HTTPFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HTTPFailureFeedbackRoleArn") } mg.Spec.InitProvider.HTTPFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.HTTPFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArn") } mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.HTTPSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaFailureFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.LambdaFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaFailureFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.LambdaFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaFailureFeedbackRoleArn") } mg.Spec.InitProvider.LambdaFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.LambdaFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArn") } mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.LambdaSuccessFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SqsFailureFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.SqsFailureFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.SqsFailureFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SqsFailureFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.SqsFailureFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.SqsFailureFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SqsFailureFeedbackRoleArn") } mg.Spec.InitProvider.SqsFailureFeedbackRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SqsFailureFeedbackRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SqsSuccessFeedbackRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.SqsSuccessFeedbackRoleArnRef, - Selector: mg.Spec.InitProvider.SqsSuccessFeedbackRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SqsSuccessFeedbackRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.SqsSuccessFeedbackRoleArnRef, + Selector: mg.Spec.InitProvider.SqsSuccessFeedbackRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SqsSuccessFeedbackRoleArn") } @@ -464,37 +735,58 @@ func (mg *Topic) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this TopicPolicy. func (mg *TopicPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ArnRef, - Selector: mg.Spec.ForProvider.ArnSelector, - To: reference.To{ - List: &TopicList{}, - Managed: &Topic{}, - }, - }) + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ArnRef, + Selector: mg.Spec.ForProvider.ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Arn") } mg.Spec.ForProvider.Arn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Arn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ArnRef, - Selector: mg.Spec.InitProvider.ArnSelector, - To: reference.To{ - List: &TopicList{}, - Managed: &Topic{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Arn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ArnRef, + Selector: mg.Spec.InitProvider.ArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Arn") } @@ -506,101 +798,160 @@ func (mg *TopicPolicy) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this TopicSubscription. func (mg *TopicSubscription) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Endpoint), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.EndpointRef, - Selector: mg.Spec.ForProvider.EndpointSelector, - To: reference.To{ - List: &v1beta11.QueueList{}, - Managed: &v1beta11.Queue{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Endpoint), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.EndpointRef, + Selector: mg.Spec.ForProvider.EndpointSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Endpoint") } mg.Spec.ForProvider.Endpoint = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.EndpointRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubscriptionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.SubscriptionRoleArnRef, - Selector: mg.Spec.ForProvider.SubscriptionRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubscriptionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.SubscriptionRoleArnRef, + Selector: mg.Spec.ForProvider.SubscriptionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubscriptionRoleArn") } mg.Spec.ForProvider.SubscriptionRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SubscriptionRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TopicArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.TopicArnRef, - Selector: mg.Spec.ForProvider.TopicArnSelector, - To: reference.To{ - List: &TopicList{}, - Managed: &Topic{}, - }, - }) + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TopicArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.TopicArnRef, + Selector: mg.Spec.ForProvider.TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TopicArn") } mg.Spec.ForProvider.TopicArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.TopicArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Endpoint), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.EndpointRef, - Selector: mg.Spec.InitProvider.EndpointSelector, - To: reference.To{ - List: &v1beta11.QueueList{}, - Managed: &v1beta11.Queue{}, - }, - }) + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Endpoint), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.EndpointRef, + Selector: mg.Spec.InitProvider.EndpointSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Endpoint") } mg.Spec.InitProvider.Endpoint = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.EndpointRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubscriptionRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.SubscriptionRoleArnRef, - Selector: mg.Spec.InitProvider.SubscriptionRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubscriptionRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.SubscriptionRoleArnRef, + Selector: mg.Spec.InitProvider.SubscriptionRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubscriptionRoleArn") } mg.Spec.InitProvider.SubscriptionRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SubscriptionRoleArnRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TopicArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.TopicArnRef, - Selector: mg.Spec.InitProvider.TopicArnSelector, - To: reference.To{ - List: &TopicList{}, - Managed: &Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TopicArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.TopicArnRef, + Selector: mg.Spec.InitProvider.TopicArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TopicArn") } diff --git a/apis/sqs/v1beta1/zz_generated.resolvers.go b/apis/sqs/v1beta1/zz_generated.resolvers.go index dc53b08d33..40a6ab045c 100644 --- a/apis/sqs/v1beta1/zz_generated.resolvers.go +++ b/apis/sqs/v1beta1/zz_generated.resolvers.go @@ -8,44 +8,68 @@ package v1beta1 import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" errors "github.com/pkg/errors" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this QueuePolicy. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this QueuePolicy. func (mg *QueuePolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.QueueURL), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.QueueURLRef, - Selector: mg.Spec.ForProvider.QueueURLSelector, - To: reference.To{ - List: &QueueList{}, - Managed: &Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.QueueURL), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.QueueURLRef, + Selector: mg.Spec.ForProvider.QueueURLSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.QueueURL") } mg.Spec.ForProvider.QueueURL = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.QueueURLRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.QueueURL), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.QueueURLRef, - Selector: mg.Spec.InitProvider.QueueURLSelector, - To: reference.To{ - List: &QueueList{}, - Managed: &Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.QueueURL), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.QueueURLRef, + Selector: mg.Spec.InitProvider.QueueURLSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.QueueURL") } @@ -57,37 +81,58 @@ func (mg *QueuePolicy) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this QueueRedriveAllowPolicy. func (mg *QueueRedriveAllowPolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.QueueURL), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.QueueURLRef, - Selector: mg.Spec.ForProvider.QueueURLSelector, - To: reference.To{ - List: &QueueList{}, - Managed: &Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.QueueURL), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.QueueURLRef, + Selector: mg.Spec.ForProvider.QueueURLSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.QueueURL") } mg.Spec.ForProvider.QueueURL = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.QueueURLRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.QueueURL), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.QueueURLRef, - Selector: mg.Spec.InitProvider.QueueURLSelector, - To: reference.To{ - List: &QueueList{}, - Managed: &Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.QueueURL), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.QueueURLRef, + Selector: mg.Spec.InitProvider.QueueURLSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.QueueURL") } @@ -99,37 +144,58 @@ func (mg *QueueRedriveAllowPolicy) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this QueueRedrivePolicy. func (mg *QueueRedrivePolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.QueueURL), - Extract: common.TerraformID(), - Reference: mg.Spec.ForProvider.QueueURLRef, - Selector: mg.Spec.ForProvider.QueueURLSelector, - To: reference.To{ - List: &QueueList{}, - Managed: &Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.QueueURL), + Extract: common.TerraformID(), + Reference: mg.Spec.ForProvider.QueueURLRef, + Selector: mg.Spec.ForProvider.QueueURLSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.QueueURL") } mg.Spec.ForProvider.QueueURL = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.QueueURLRef = rsp.ResolvedReference - - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.QueueURL), - Extract: common.TerraformID(), - Reference: mg.Spec.InitProvider.QueueURLRef, - Selector: mg.Spec.InitProvider.QueueURLSelector, - To: reference.To{ - List: &QueueList{}, - Managed: &Queue{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sqs.aws.upbound.io", + + "v1beta1", + + "Queue", + "QueueList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.QueueURL), + Extract: common.TerraformID(), + Reference: mg.Spec.InitProvider.QueueURLRef, + Selector: mg.Spec.InitProvider.QueueURLSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.QueueURL") } diff --git a/apis/ssm/v1beta1/zz_generated.resolvers.go b/apis/ssm/v1beta1/zz_generated.resolvers.go index 3e30ef324e..5c0a5ec88d 100644 --- a/apis/ssm/v1beta1/zz_generated.resolvers.go +++ b/apis/ssm/v1beta1/zz_generated.resolvers.go @@ -10,47 +10,70 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/lambda/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/s3/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/sns/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Activation. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Activation. func (mg *Activation) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRole), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.IAMRoleRef, - Selector: mg.Spec.ForProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.IAMRole), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.IAMRoleRef, + Selector: mg.Spec.ForProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.IAMRole") } mg.Spec.ForProvider.IAMRole = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.IAMRoleRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRole), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.IAMRoleRef, - Selector: mg.Spec.InitProvider.IAMRoleSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.IAMRole), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.IAMRoleRef, + Selector: mg.Spec.InitProvider.IAMRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.IAMRole") } @@ -62,37 +85,58 @@ func (mg *Activation) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this Association. func (mg *Association) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", + + "v1beta1", + + "Document", + "DocumentList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.NameRef, - Selector: mg.Spec.ForProvider.NameSelector, - To: reference.To{ - List: &DocumentList{}, - Managed: &Document{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.NameRef, + Selector: mg.Spec.ForProvider.NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Name") } mg.Spec.ForProvider.Name = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.NameRef, - Selector: mg.Spec.InitProvider.NameSelector, - To: reference.To{ - List: &DocumentList{}, - Managed: &Document{}, - }, - }) + "Document", + "DocumentList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.NameRef, + Selector: mg.Spec.InitProvider.NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Name") } @@ -104,69 +148,108 @@ func (mg *Association) ResolveReferences(ctx context.Context, c client.Reader) e // ResolveReferences of this DefaultPatchBaseline. func (mg *DefaultPatchBaseline) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BaselineID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BaselineIDRef, - Selector: mg.Spec.ForProvider.BaselineIDSelector, - To: reference.To{ - List: &PatchBaselineList{}, - Managed: &PatchBaseline{}, - }, - }) + "v1beta1", + + "PatchBaseline", + "PatchBaselineList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BaselineID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BaselineIDRef, + Selector: mg.Spec.ForProvider.BaselineIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BaselineID") } mg.Spec.ForProvider.BaselineID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BaselineIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OperatingSystem), - Extract: resource.ExtractParamPath("operating_system", false), - Reference: mg.Spec.ForProvider.OperatingSystemRef, - Selector: mg.Spec.ForProvider.OperatingSystemSelector, - To: reference.To{ - List: &PatchBaselineList{}, - Managed: &PatchBaseline{}, - }, - }) + "v1beta1", + + "PatchBaseline", + "PatchBaselineList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.OperatingSystem), + Extract: resource.ExtractParamPath("operating_system", false), + Reference: mg.Spec.ForProvider.OperatingSystemRef, + Selector: mg.Spec.ForProvider.OperatingSystemSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.OperatingSystem") } mg.Spec.ForProvider.OperatingSystem = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.OperatingSystemRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BaselineID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BaselineIDRef, - Selector: mg.Spec.InitProvider.BaselineIDSelector, - To: reference.To{ - List: &PatchBaselineList{}, - Managed: &PatchBaseline{}, - }, - }) + "v1beta1", + + "PatchBaseline", + "PatchBaselineList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BaselineID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BaselineIDRef, + Selector: mg.Spec.InitProvider.BaselineIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BaselineID") } mg.Spec.InitProvider.BaselineID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.BaselineIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OperatingSystem), - Extract: resource.ExtractParamPath("operating_system", false), - Reference: mg.Spec.InitProvider.OperatingSystemRef, - Selector: mg.Spec.InitProvider.OperatingSystemSelector, - To: reference.To{ - List: &PatchBaselineList{}, - Managed: &PatchBaseline{}, - }, - }) + "v1beta1", + + "PatchBaseline", + "PatchBaselineList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.OperatingSystem), + Extract: resource.ExtractParamPath("operating_system", false), + Reference: mg.Spec.InitProvider.OperatingSystemRef, + Selector: mg.Spec.InitProvider.OperatingSystemSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.OperatingSystem") } @@ -178,37 +261,58 @@ func (mg *DefaultPatchBaseline) ResolveReferences(ctx context.Context, c client. // ResolveReferences of this MaintenanceWindowTarget. func (mg *MaintenanceWindowTarget) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WindowID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WindowIDRef, - Selector: mg.Spec.ForProvider.WindowIDSelector, - To: reference.To{ - List: &MaintenanceWindowList{}, - Managed: &MaintenanceWindow{}, - }, - }) + "v1beta1", + + "MaintenanceWindow", + + "MaintenanceWindowList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WindowID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WindowIDRef, + Selector: mg.Spec.ForProvider.WindowIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WindowID") } mg.Spec.ForProvider.WindowID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.WindowIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WindowID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.WindowIDRef, - Selector: mg.Spec.InitProvider.WindowIDSelector, - To: reference.To{ - List: &MaintenanceWindowList{}, - Managed: &MaintenanceWindow{}, - }, - }) + "MaintenanceWindow", + + "MaintenanceWindowList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WindowID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.WindowIDRef, + Selector: mg.Spec.InitProvider.WindowIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WindowID") } @@ -220,37 +324,59 @@ func (mg *MaintenanceWindowTarget) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this MaintenanceWindowTask. func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.ServiceRoleArnRef, - Selector: mg.Spec.ForProvider.ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ServiceRoleArnRef, + Selector: mg.Spec.ForProvider.ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServiceRoleArn") } mg.Spec.ForProvider.ServiceRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServiceRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TaskArnRef, - Selector: mg.Spec.ForProvider.TaskArnSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TaskArnRef, + Selector: mg.Spec.ForProvider.TaskArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TaskArn") } @@ -260,16 +386,26 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.ForProvider.TaskInvocationParameters); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters); i4++ { for i5 := 0; i5 < len(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArnRef, - Selector: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArnRef, + Selector: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArn") } @@ -281,16 +417,26 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.ForProvider.TaskInvocationParameters); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3BucketRef, - Selector: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3BucketSelector, - To: reference.To{ - List: &v1beta13.BucketList{}, - Managed: &v1beta13.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3BucketRef, + Selector: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3Bucket") } @@ -301,16 +447,27 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.ForProvider.TaskInvocationParameters); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArnRef, - Selector: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArnRef, + Selector: mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArn") } @@ -319,48 +476,77 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WindowID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WindowIDRef, - Selector: mg.Spec.ForProvider.WindowIDSelector, - To: reference.To{ - List: &MaintenanceWindowList{}, - Managed: &MaintenanceWindow{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", + + "v1beta1", + + "MaintenanceWindow", + + "MaintenanceWindowList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WindowID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WindowIDRef, + Selector: mg.Spec.ForProvider.WindowIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WindowID") } mg.Spec.ForProvider.WindowID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.WindowIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceRoleArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.ServiceRoleArnRef, - Selector: mg.Spec.InitProvider.ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServiceRoleArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.ServiceRoleArnRef, + Selector: mg.Spec.InitProvider.ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServiceRoleArn") } mg.Spec.InitProvider.ServiceRoleArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ServiceRoleArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TaskArnRef, - Selector: mg.Spec.InitProvider.TaskArnSelector, - To: reference.To{ - List: &v1beta11.FunctionList{}, - Managed: &v1beta11.Function{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TaskArnRef, + Selector: mg.Spec.InitProvider.TaskArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TaskArn") } @@ -370,16 +556,26 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client for i3 := 0; i3 < len(mg.Spec.InitProvider.TaskInvocationParameters); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters); i4++ { for i5 := 0; i5 < len(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig); i5++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArnRef, - Selector: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArnSelector, - To: reference.To{ - List: &v1beta12.TopicList{}, - Managed: &v1beta12.Topic{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("sns.aws.upbound.io", + + "v1beta1", + + "Topic", + "TopicList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArnRef, + Selector: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].NotificationConfig[i5].NotificationArn") } @@ -391,16 +587,26 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.InitProvider.TaskInvocationParameters); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3Bucket), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3BucketRef, - Selector: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3BucketSelector, - To: reference.To{ - List: &v1beta13.BucketList{}, - Managed: &v1beta13.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3Bucket), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3BucketRef, + Selector: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3BucketSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].OutputS3Bucket") } @@ -411,16 +617,27 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client } for i3 := 0; i3 < len(mg.Spec.InitProvider.TaskInvocationParameters); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArnRef, - Selector: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArnRef, + Selector: mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.TaskInvocationParameters[i3].RunCommandParameters[i4].ServiceRoleArn") } @@ -429,16 +646,26 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client } } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WindowID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.WindowIDRef, - Selector: mg.Spec.InitProvider.WindowIDSelector, - To: reference.To{ - List: &MaintenanceWindowList{}, - Managed: &MaintenanceWindow{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", + + "v1beta1", + + "MaintenanceWindow", + + "MaintenanceWindowList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WindowID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.WindowIDRef, + Selector: mg.Spec.InitProvider.WindowIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WindowID") } @@ -450,37 +677,58 @@ func (mg *MaintenanceWindowTask) ResolveReferences(ctx context.Context, c client // ResolveReferences of this PatchGroup. func (mg *PatchGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BaselineID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.BaselineIDRef, - Selector: mg.Spec.ForProvider.BaselineIDSelector, - To: reference.To{ - List: &PatchBaselineList{}, - Managed: &PatchBaseline{}, - }, - }) + "v1beta1", + + "PatchBaseline", + "PatchBaselineList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.BaselineID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.BaselineIDRef, + Selector: mg.Spec.ForProvider.BaselineIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.BaselineID") } mg.Spec.ForProvider.BaselineID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.BaselineIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ssm.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BaselineID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.BaselineIDRef, - Selector: mg.Spec.InitProvider.BaselineIDSelector, - To: reference.To{ - List: &PatchBaselineList{}, - Managed: &PatchBaseline{}, - }, - }) + "v1beta1", + + "PatchBaseline", + "PatchBaselineList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.BaselineID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.BaselineIDRef, + Selector: mg.Spec.InitProvider.BaselineIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.BaselineID") } @@ -492,22 +740,35 @@ func (mg *PatchGroup) ResolveReferences(ctx context.Context, c client.Reader) er // ResolveReferences of this ResourceDataSync. func (mg *ResourceDataSync) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.S3Destination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Destination[i3].BucketName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.S3Destination[i3].BucketNameRef, - Selector: mg.Spec.ForProvider.S3Destination[i3].BucketNameSelector, - To: reference.To{ - List: &v1beta13.BucketList{}, - Managed: &v1beta13.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Destination[i3].BucketName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.S3Destination[i3].BucketNameRef, + Selector: mg.Spec.ForProvider.S3Destination[i3].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3Destination[i3].BucketName") } @@ -516,16 +777,26 @@ func (mg *ResourceDataSync) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.ForProvider.S3Destination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Destination[i3].Region), - Extract: resource.ExtractParamPath("region", false), - Reference: mg.Spec.ForProvider.S3Destination[i3].RegionRef, - Selector: mg.Spec.ForProvider.S3Destination[i3].RegionSelector, - To: reference.To{ - List: &v1beta13.BucketList{}, - Managed: &v1beta13.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.S3Destination[i3].Region), + Extract: resource.ExtractParamPath("region", false), + Reference: mg.Spec.ForProvider.S3Destination[i3].RegionRef, + Selector: mg.Spec.ForProvider.S3Destination[i3].RegionSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.S3Destination[i3].Region") } @@ -534,16 +805,26 @@ func (mg *ResourceDataSync) ResolveReferences(ctx context.Context, c client.Read } for i3 := 0; i3 < len(mg.Spec.InitProvider.S3Destination); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Destination[i3].BucketName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.S3Destination[i3].BucketNameRef, - Selector: mg.Spec.InitProvider.S3Destination[i3].BucketNameSelector, - To: reference.To{ - List: &v1beta13.BucketList{}, - Managed: &v1beta13.Bucket{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("s3.aws.upbound.io", + + "v1beta1", + + "Bucket", + "BucketList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.S3Destination[i3].BucketName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.S3Destination[i3].BucketNameRef, + Selector: mg.Spec.InitProvider.S3Destination[i3].BucketNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.S3Destination[i3].BucketName") } diff --git a/apis/ssoadmin/v1beta1/zz_generated.resolvers.go b/apis/ssoadmin/v1beta1/zz_generated.resolvers.go index b86d33e5da..58689872c5 100644 --- a/apis/ssoadmin/v1beta1/zz_generated.resolvers.go +++ b/apis/ssoadmin/v1beta1/zz_generated.resolvers.go @@ -10,45 +10,67 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta1 "github.com/upbound/provider-aws/apis/identitystore/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this AccountAssignment. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this AccountAssignment. func (mg *AccountAssignment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ssoadmin.aws.upbound.io", + + "v1beta1", + + "PermissionSet", + + "PermissionSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.PermissionSetArnRef, - Selector: mg.Spec.ForProvider.PermissionSetArnSelector, - To: reference.To{ - List: &PermissionSetList{}, - Managed: &PermissionSet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.PermissionSetArnRef, + Selector: mg.Spec.ForProvider.PermissionSetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PermissionSetArn") } mg.Spec.ForProvider.PermissionSetArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.PermissionSetArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("identitystore.aws.upbound.io", + + "v1beta1", + "Group", + "GroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrincipalID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PrincipalIDFromGroupRef, - Selector: mg.Spec.ForProvider.PrincipalIDFromGroupSelector, - To: reference.To{ - List: &v1beta1.GroupList{}, - Managed: &v1beta1.Group{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrincipalID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PrincipalIDFromGroupRef, + Selector: mg.Spec.ForProvider.PrincipalIDFromGroupSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PrincipalID") } @@ -60,22 +82,35 @@ func (mg *AccountAssignment) ResolveReferences(ctx context.Context, c client.Rea // ResolveReferences of this CustomerManagedPolicyAttachment. func (mg *CustomerManagedPolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.CustomerManagedPolicyReference); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomerManagedPolicyReference[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.CustomerManagedPolicyReference[i3].PolicyNameRef, - Selector: mg.Spec.ForProvider.CustomerManagedPolicyReference[i3].PolicyNameSelector, - To: reference.To{ - List: &v1beta11.PolicyList{}, - Managed: &v1beta11.Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.CustomerManagedPolicyReference[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.CustomerManagedPolicyReference[i3].PolicyNameRef, + Selector: mg.Spec.ForProvider.CustomerManagedPolicyReference[i3].PolicyNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.CustomerManagedPolicyReference[i3].Name") } @@ -83,16 +118,26 @@ func (mg *CustomerManagedPolicyAttachment) ResolveReferences(ctx context.Context mg.Spec.ForProvider.CustomerManagedPolicyReference[i3].PolicyNameRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.PermissionSetArnRef, - Selector: mg.Spec.ForProvider.PermissionSetArnSelector, - To: reference.To{ - List: &PermissionSetList{}, - Managed: &PermissionSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ssoadmin.aws.upbound.io", + + "v1beta1", + + "PermissionSet", + + "PermissionSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.PermissionSetArnRef, + Selector: mg.Spec.ForProvider.PermissionSetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PermissionSetArn") } @@ -100,16 +145,26 @@ func (mg *CustomerManagedPolicyAttachment) ResolveReferences(ctx context.Context mg.Spec.ForProvider.PermissionSetArnRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.CustomerManagedPolicyReference); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CustomerManagedPolicyReference[i3].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.CustomerManagedPolicyReference[i3].PolicyNameRef, - Selector: mg.Spec.InitProvider.CustomerManagedPolicyReference[i3].PolicyNameSelector, - To: reference.To{ - List: &v1beta11.PolicyList{}, - Managed: &v1beta11.Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.CustomerManagedPolicyReference[i3].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.CustomerManagedPolicyReference[i3].PolicyNameRef, + Selector: mg.Spec.InitProvider.CustomerManagedPolicyReference[i3].PolicyNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.CustomerManagedPolicyReference[i3].Name") } @@ -123,21 +178,33 @@ func (mg *CustomerManagedPolicyAttachment) ResolveReferences(ctx context.Context // ResolveReferences of this ManagedPolicyAttachment. func (mg *ManagedPolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ssoadmin.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.PermissionSetArnRef, - Selector: mg.Spec.ForProvider.PermissionSetArnSelector, - To: reference.To{ - List: &PermissionSetList{}, - Managed: &PermissionSet{}, - }, - }) + "v1beta1", + + "PermissionSet", + + "PermissionSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.PermissionSetArnRef, + Selector: mg.Spec.ForProvider.PermissionSetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PermissionSetArn") } @@ -149,21 +216,33 @@ func (mg *ManagedPolicyAttachment) ResolveReferences(ctx context.Context, c clie // ResolveReferences of this PermissionSetInlinePolicy. func (mg *PermissionSetInlinePolicy) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ssoadmin.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.PermissionSetArnRef, - Selector: mg.Spec.ForProvider.PermissionSetArnSelector, - To: reference.To{ - List: &PermissionSetList{}, - Managed: &PermissionSet{}, - }, - }) + "v1beta1", + + "PermissionSet", + + "PermissionSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.PermissionSetArnRef, + Selector: mg.Spec.ForProvider.PermissionSetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PermissionSetArn") } @@ -175,21 +254,33 @@ func (mg *PermissionSetInlinePolicy) ResolveReferences(ctx context.Context, c cl // ResolveReferences of this PermissionsBoundaryAttachment. func (mg *PermissionsBoundaryAttachment) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ssoadmin.aws.upbound.io", + + "v1beta1", + + "PermissionSet", + + "PermissionSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.PermissionSetArnRef, - Selector: mg.Spec.ForProvider.PermissionSetArnSelector, - To: reference.To{ - List: &PermissionSetList{}, - Managed: &PermissionSet{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionSetArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.PermissionSetArnRef, + Selector: mg.Spec.ForProvider.PermissionSetArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PermissionSetArn") } @@ -198,16 +289,26 @@ func (mg *PermissionsBoundaryAttachment) ResolveReferences(ctx context.Context, for i3 := 0; i3 < len(mg.Spec.ForProvider.PermissionsBoundary); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].NameRef, - Selector: mg.Spec.ForProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].NameSelector, - To: reference.To{ - List: &v1beta11.PolicyList{}, - Managed: &v1beta11.Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].NameRef, + Selector: mg.Spec.ForProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].Name") } @@ -218,16 +319,26 @@ func (mg *PermissionsBoundaryAttachment) ResolveReferences(ctx context.Context, } for i3 := 0; i3 < len(mg.Spec.InitProvider.PermissionsBoundary); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].Name), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].NameRef, - Selector: mg.Spec.InitProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].NameSelector, - To: reference.To{ - List: &v1beta11.PolicyList{}, - Managed: &v1beta11.Policy{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Policy", + "PolicyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].Name), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].NameRef, + Selector: mg.Spec.InitProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].NameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.PermissionsBoundary[i3].CustomerManagedPolicyReference[i4].Name") } diff --git a/apis/timestreamwrite/v1beta1/zz_generated.resolvers.go b/apis/timestreamwrite/v1beta1/zz_generated.resolvers.go index e4ac264393..b9fe6654bd 100644 --- a/apis/timestreamwrite/v1beta1/zz_generated.resolvers.go +++ b/apis/timestreamwrite/v1beta1/zz_generated.resolvers.go @@ -9,43 +9,65 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Database. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this Database. func (mg *Database) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.KMSKeyIDRef, - Selector: mg.Spec.ForProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") } mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.KMSKeyIDRef, - Selector: mg.Spec.InitProvider.KMSKeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") } @@ -57,21 +79,32 @@ func (mg *Database) ResolveReferences(ctx context.Context, c client.Reader) erro // ResolveReferences of this Table. func (mg *Table) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("timestreamwrite.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DatabaseName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.DatabaseNameRef, - Selector: mg.Spec.ForProvider.DatabaseNameSelector, - To: reference.To{ - List: &DatabaseList{}, - Managed: &Database{}, - }, - }) + "v1beta1", + "Database", + + "DatabaseList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DatabaseName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.DatabaseNameRef, + Selector: mg.Spec.ForProvider.DatabaseNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DatabaseName") } diff --git a/apis/transcribe/v1beta1/zz_generated.resolvers.go b/apis/transcribe/v1beta1/zz_generated.resolvers.go index 4be01e3052..c01866c99a 100644 --- a/apis/transcribe/v1beta1/zz_generated.resolvers.go +++ b/apis/transcribe/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,45 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this LanguageModel. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this LanguageModel. func (mg *LanguageModel) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.InputDataConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InputDataConfig[i3].DataAccessRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.InputDataConfig[i3].DataAccessRoleArnRef, - Selector: mg.Spec.ForProvider.InputDataConfig[i3].DataAccessRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InputDataConfig[i3].DataAccessRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.InputDataConfig[i3].DataAccessRoleArnRef, + Selector: mg.Spec.ForProvider.InputDataConfig[i3].DataAccessRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.InputDataConfig[i3].DataAccessRoleArn") } @@ -40,16 +57,27 @@ func (mg *LanguageModel) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.InitProvider.InputDataConfig); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InputDataConfig[i3].DataAccessRoleArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.InputDataConfig[i3].DataAccessRoleArnRef, - Selector: mg.Spec.InitProvider.InputDataConfig[i3].DataAccessRoleArnSelector, - To: reference.To{ - List: &v1beta1.RoleList{}, - Managed: &v1beta1.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InputDataConfig[i3].DataAccessRoleArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.InputDataConfig[i3].DataAccessRoleArnRef, + Selector: mg.Spec.InitProvider.InputDataConfig[i3].DataAccessRoleArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.InputDataConfig[i3].DataAccessRoleArn") } diff --git a/apis/transfer/v1beta1/zz_generated.resolvers.go b/apis/transfer/v1beta1/zz_generated.resolvers.go index f4e7fec066..4b88474b07 100644 --- a/apis/transfer/v1beta1/zz_generated.resolvers.go +++ b/apis/transfer/v1beta1/zz_generated.resolvers.go @@ -10,80 +10,118 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/acm/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/ds/v1beta1" - v1beta12 "github.com/upbound/provider-aws/apis/ec2/v1beta1" - v1beta13 "github.com/upbound/provider-aws/apis/iam/v1beta1" - v1beta14 "github.com/upbound/provider-aws/apis/lambda/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" common "github.com/upbound/provider-aws/config/common" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this SSHKey. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this SSHKey. func (mg *SSHKey) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("transfer.aws.upbound.io", + + "v1beta1", + + "Server", + "ServerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServerID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.ServerIDRef, - Selector: mg.Spec.ForProvider.ServerIDSelector, - To: reference.To{ - List: &ServerList{}, - Managed: &Server{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServerID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ServerIDRef, + Selector: mg.Spec.ForProvider.ServerIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServerID") } mg.Spec.ForProvider.ServerID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServerIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("transfer.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserName), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.UserNameRef, - Selector: mg.Spec.ForProvider.UserNameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.UserName), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.UserNameRef, + Selector: mg.Spec.ForProvider.UserNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.UserName") } mg.Spec.ForProvider.UserName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.UserNameRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("transfer.aws.upbound.io", + + "v1beta1", + + "Server", + "ServerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServerID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.ServerIDRef, - Selector: mg.Spec.InitProvider.ServerIDSelector, - To: reference.To{ - List: &ServerList{}, - Managed: &Server{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServerID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ServerIDRef, + Selector: mg.Spec.InitProvider.ServerIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServerID") } mg.Spec.InitProvider.ServerID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.ServerIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("transfer.aws.upbound.io", + + "v1beta1", + + "User", + "UserList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserName), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.UserNameRef, - Selector: mg.Spec.InitProvider.UserNameSelector, - To: reference.To{ - List: &UserList{}, - Managed: &User{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.UserName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.UserNameRef, + Selector: mg.Spec.InitProvider.UserNameSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.UserName") } @@ -95,37 +133,58 @@ func (mg *SSHKey) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Server. func (mg *Server) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Certificate), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.CertificateRef, - Selector: mg.Spec.ForProvider.CertificateSelector, - To: reference.To{ - List: &v1beta1.CertificateList{}, - Managed: &v1beta1.Certificate{}, - }, - }) + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Certificate), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.CertificateRef, + Selector: mg.Spec.ForProvider.CertificateSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Certificate") } mg.Spec.ForProvider.Certificate = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.CertificateRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DirectoryIDRef, - Selector: mg.Spec.ForProvider.DirectoryIDSelector, - To: reference.To{ - List: &v1beta11.DirectoryList{}, - Managed: &v1beta11.Directory{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DirectoryIDRef, + Selector: mg.Spec.ForProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DirectoryID") } @@ -133,16 +192,25 @@ func (mg *Server) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.DirectoryIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.ForProvider.EndpointDetails); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EndpointDetails[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.EndpointDetails[i3].VPCIDRef, - Selector: mg.Spec.ForProvider.EndpointDetails[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta12.VPCList{}, - Managed: &v1beta12.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.EndpointDetails[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.EndpointDetails[i3].VPCIDRef, + Selector: mg.Spec.ForProvider.EndpointDetails[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.EndpointDetails[i3].VPCID") } @@ -150,48 +218,77 @@ func (mg *Server) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.EndpointDetails[i3].VPCIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingRole), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.LoggingRoleRef, - Selector: mg.Spec.ForProvider.LoggingRoleSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingRole), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.LoggingRoleRef, + Selector: mg.Spec.ForProvider.LoggingRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoggingRole") } mg.Spec.ForProvider.LoggingRole = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.LoggingRoleRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("acm.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Certificate), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.CertificateRef, - Selector: mg.Spec.InitProvider.CertificateSelector, - To: reference.To{ - List: &v1beta1.CertificateList{}, - Managed: &v1beta1.Certificate{}, - }, - }) + "Certificate", + "CertificateList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Certificate), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.CertificateRef, + Selector: mg.Spec.InitProvider.CertificateSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Certificate") } mg.Spec.InitProvider.Certificate = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.CertificateRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DirectoryIDRef, - Selector: mg.Spec.InitProvider.DirectoryIDSelector, - To: reference.To{ - List: &v1beta11.DirectoryList{}, - Managed: &v1beta11.Directory{}, - }, - }) + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DirectoryIDRef, + Selector: mg.Spec.InitProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DirectoryID") } @@ -199,16 +296,25 @@ func (mg *Server) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.DirectoryIDRef = rsp.ResolvedReference for i3 := 0; i3 < len(mg.Spec.InitProvider.EndpointDetails); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EndpointDetails[i3].VPCID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.EndpointDetails[i3].VPCIDRef, - Selector: mg.Spec.InitProvider.EndpointDetails[i3].VPCIDSelector, - To: reference.To{ - List: &v1beta12.VPCList{}, - Managed: &v1beta12.VPC{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "VPC", "VPCList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.EndpointDetails[i3].VPCID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.EndpointDetails[i3].VPCIDRef, + Selector: mg.Spec.InitProvider.EndpointDetails[i3].VPCIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.EndpointDetails[i3].VPCID") } @@ -216,16 +322,27 @@ func (mg *Server) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.EndpointDetails[i3].VPCIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingRole), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.LoggingRoleRef, - Selector: mg.Spec.InitProvider.LoggingRoleSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingRole), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.LoggingRoleRef, + Selector: mg.Spec.InitProvider.LoggingRoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoggingRole") } @@ -237,37 +354,58 @@ func (mg *Server) ResolveReferences(ctx context.Context, c client.Reader) error // ResolveReferences of this Tag. func (mg *Tag) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("transfer.aws.upbound.io", + + "v1beta1", + + "Server", + "ServerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.ResourceArnRef, - Selector: mg.Spec.ForProvider.ResourceArnSelector, - To: reference.To{ - List: &ServerList{}, - Managed: &Server{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.ResourceArnRef, + Selector: mg.Spec.ForProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ResourceArn") } mg.Spec.ForProvider.ResourceArn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceArnRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("transfer.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.ResourceArnRef, - Selector: mg.Spec.InitProvider.ResourceArnSelector, - To: reference.To{ - List: &ServerList{}, - Managed: &Server{}, - }, - }) + "v1beta1", + + "Server", + "ServerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceArn), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.ResourceArnRef, + Selector: mg.Spec.InitProvider.ResourceArnSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ResourceArn") } @@ -279,69 +417,110 @@ func (mg *Tag) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this User. func (mg *User) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", + + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), - Extract: common.ARNExtractor(), - Reference: mg.Spec.ForProvider.RoleRef, - Selector: mg.Spec.ForProvider.RoleSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.RoleRef, + Selector: mg.Spec.ForProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Role") } mg.Spec.ForProvider.Role = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.RoleRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("transfer.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServerID), - Extract: reference.ExternalName(), - Reference: mg.Spec.ForProvider.ServerIDRef, - Selector: mg.Spec.ForProvider.ServerIDSelector, - To: reference.To{ - List: &ServerList{}, - Managed: &Server{}, - }, - }) + "v1beta1", + + "Server", + "ServerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ServerID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ServerIDRef, + Selector: mg.Spec.ForProvider.ServerIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.ServerID") } mg.Spec.ForProvider.ServerID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ServerIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("iam.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), - Extract: common.ARNExtractor(), - Reference: mg.Spec.InitProvider.RoleRef, - Selector: mg.Spec.InitProvider.RoleSelector, - To: reference.To{ - List: &v1beta13.RoleList{}, - Managed: &v1beta13.Role{}, - }, - }) + "Role", + "RoleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Role), + Extract: common.ARNExtractor(), + Reference: mg.Spec.InitProvider.RoleRef, + Selector: mg.Spec.InitProvider.RoleSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Role") } mg.Spec.InitProvider.Role = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.RoleRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("transfer.aws.upbound.io", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServerID), - Extract: reference.ExternalName(), - Reference: mg.Spec.InitProvider.ServerIDRef, - Selector: mg.Spec.InitProvider.ServerIDSelector, - To: reference.To{ - List: &ServerList{}, - Managed: &Server{}, - }, - }) + "v1beta1", + + "Server", + "ServerList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ServerID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.ServerIDRef, + Selector: mg.Spec.InitProvider.ServerIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.ServerID") } @@ -353,6 +532,9 @@ func (mg *User) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this Workflow. func (mg *Workflow) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse @@ -360,16 +542,26 @@ func (mg *Workflow) ResolveReferences(ctx context.Context, c client.Reader) erro for i3 := 0; i3 < len(mg.Spec.ForProvider.Steps); i3++ { for i4 := 0; i4 < len(mg.Spec.ForProvider.Steps[i3].CustomStepDetails); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Steps[i3].CustomStepDetails[i4].Target), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.Steps[i3].CustomStepDetails[i4].TargetRef, - Selector: mg.Spec.ForProvider.Steps[i3].CustomStepDetails[i4].TargetSelector, - To: reference.To{ - List: &v1beta14.FunctionList{}, - Managed: &v1beta14.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Steps[i3].CustomStepDetails[i4].Target), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.Steps[i3].CustomStepDetails[i4].TargetRef, + Selector: mg.Spec.ForProvider.Steps[i3].CustomStepDetails[i4].TargetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Steps[i3].CustomStepDetails[i4].Target") } @@ -380,16 +572,26 @@ func (mg *Workflow) ResolveReferences(ctx context.Context, c client.Reader) erro } for i3 := 0; i3 < len(mg.Spec.InitProvider.Steps); i3++ { for i4 := 0; i4 < len(mg.Spec.InitProvider.Steps[i3].CustomStepDetails); i4++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Steps[i3].CustomStepDetails[i4].Target), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.Steps[i3].CustomStepDetails[i4].TargetRef, - Selector: mg.Spec.InitProvider.Steps[i3].CustomStepDetails[i4].TargetSelector, - To: reference.To{ - List: &v1beta14.FunctionList{}, - Managed: &v1beta14.Function{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("lambda.aws.upbound.io", + + "v1beta1", + + "Function", + "FunctionList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Steps[i3].CustomStepDetails[i4].Target), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.Steps[i3].CustomStepDetails[i4].TargetRef, + Selector: mg.Spec.InitProvider.Steps[i3].CustomStepDetails[i4].TargetSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Steps[i3].CustomStepDetails[i4].Target") } diff --git a/apis/waf/v1beta1/zz_generated.resolvers.go b/apis/waf/v1beta1/zz_generated.resolvers.go index dde886f401..95f5460dba 100644 --- a/apis/waf/v1beta1/zz_generated.resolvers.go +++ b/apis/waf/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,44 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/firehose/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this RateBasedRule. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this RateBasedRule. func (mg *RateBasedRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Predicates); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicates[i3].DataID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Predicates[i3].DataIDRef, - Selector: mg.Spec.ForProvider.Predicates[i3].DataIDSelector, - To: reference.To{ - List: &IPSetList{}, - Managed: &IPSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("waf.aws.upbound.io", + + "v1beta1", + + "IPSet", + "IPSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicates[i3].DataID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Predicates[i3].DataIDRef, + Selector: mg.Spec.ForProvider.Predicates[i3].DataIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Predicates[i3].DataID") } @@ -40,16 +56,26 @@ func (mg *RateBasedRule) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.InitProvider.Predicates); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicates[i3].DataID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Predicates[i3].DataIDRef, - Selector: mg.Spec.InitProvider.Predicates[i3].DataIDSelector, - To: reference.To{ - List: &IPSetList{}, - Managed: &IPSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("waf.aws.upbound.io", + + "v1beta1", + + "IPSet", + "IPSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicates[i3].DataID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Predicates[i3].DataIDRef, + Selector: mg.Spec.InitProvider.Predicates[i3].DataIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Predicates[i3].DataID") } @@ -63,22 +89,36 @@ func (mg *RateBasedRule) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this RegexMatchSet. func (mg *RegexMatchSet) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.RegexMatchTuple); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetIDRef, - Selector: mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetIDSelector, - To: reference.To{ - List: &RegexPatternSetList{}, - Managed: &RegexPatternSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("waf.aws.upbound.io", + + "v1beta1", + + "RegexPatternSet", + + "RegexPatternSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetIDRef, + Selector: mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetID") } @@ -87,16 +127,27 @@ func (mg *RegexMatchSet) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.InitProvider.RegexMatchTuple); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetIDRef, - Selector: mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetIDSelector, - To: reference.To{ - List: &RegexPatternSetList{}, - Managed: &RegexPatternSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("waf.aws.upbound.io", + + "v1beta1", + + "RegexPatternSet", + + "RegexPatternSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetIDRef, + Selector: mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetID") } @@ -110,22 +161,35 @@ func (mg *RegexMatchSet) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Rule. func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Predicates); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicates[i3].DataID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Predicates[i3].DataIDRef, - Selector: mg.Spec.ForProvider.Predicates[i3].DataIDSelector, - To: reference.To{ - List: &IPSetList{}, - Managed: &IPSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("waf.aws.upbound.io", + + "v1beta1", + + "IPSet", + "IPSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicates[i3].DataID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Predicates[i3].DataIDRef, + Selector: mg.Spec.ForProvider.Predicates[i3].DataIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Predicates[i3].DataID") } @@ -134,16 +198,26 @@ func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.InitProvider.Predicates); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicates[i3].DataID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Predicates[i3].DataIDRef, - Selector: mg.Spec.InitProvider.Predicates[i3].DataIDSelector, - To: reference.To{ - List: &IPSetList{}, - Managed: &IPSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("waf.aws.upbound.io", + + "v1beta1", + + "IPSet", + "IPSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicates[i3].DataID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Predicates[i3].DataIDRef, + Selector: mg.Spec.InitProvider.Predicates[i3].DataIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Predicates[i3].DataID") } @@ -157,22 +231,35 @@ func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this WebACL. func (mg *WebACL) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.LoggingConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestination), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestinationRef, - Selector: mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestinationSelector, - To: reference.To{ - List: &v1beta1.DeliveryStreamList{}, - Managed: &v1beta1.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestination), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestinationRef, + Selector: mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestination") } @@ -181,16 +268,27 @@ func (mg *WebACL) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.Rules); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rules[i3].RuleID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Rules[i3].RuleIDRef, - Selector: mg.Spec.ForProvider.Rules[i3].RuleIDSelector, - To: reference.To{ - List: &RuleList{}, - Managed: &Rule{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("waf.aws.upbound.io", + + "v1beta1", + + "Rule", + "RuleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rules[i3].RuleID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Rules[i3].RuleIDRef, + Selector: mg.Spec.ForProvider.Rules[i3].RuleIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Rules[i3].RuleID") } @@ -199,16 +297,26 @@ func (mg *WebACL) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.LoggingConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestination), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestinationRef, - Selector: mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestinationSelector, - To: reference.To{ - List: &v1beta1.DeliveryStreamList{}, - Managed: &v1beta1.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestination), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestinationRef, + Selector: mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestination") } @@ -217,16 +325,27 @@ func (mg *WebACL) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.Rules); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rules[i3].RuleID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Rules[i3].RuleIDRef, - Selector: mg.Spec.InitProvider.Rules[i3].RuleIDSelector, - To: reference.To{ - List: &RuleList{}, - Managed: &Rule{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("waf.aws.upbound.io", + + "v1beta1", + + "Rule", + "RuleList", + ) + + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rules[i3].RuleID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Rules[i3].RuleIDRef, + Selector: mg.Spec.InitProvider.Rules[i3].RuleIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Rules[i3].RuleID") } diff --git a/apis/wafregional/v1beta1/zz_generated.resolvers.go b/apis/wafregional/v1beta1/zz_generated.resolvers.go index d8588216ef..97ca9dafbf 100644 --- a/apis/wafregional/v1beta1/zz_generated.resolvers.go +++ b/apis/wafregional/v1beta1/zz_generated.resolvers.go @@ -10,28 +10,43 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/firehose/v1beta1" + + apisresolver "github.com/upbound/provider-aws/internal/apis" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this RateBasedRule. + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" ) -// ResolveReferences of this RateBasedRule. func (mg *RateBasedRule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Predicate); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicate[i3].DataID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Predicate[i3].DataIDRef, - Selector: mg.Spec.ForProvider.Predicate[i3].DataIDSelector, - To: reference.To{ - List: &IPSetList{}, - Managed: &IPSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("wafregional.aws.upbound.io", + + "v1beta1", + + "IPSet", "IPSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicate[i3].DataID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Predicate[i3].DataIDRef, + Selector: mg.Spec.ForProvider.Predicate[i3].DataIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Predicate[i3].DataID") } @@ -40,16 +55,25 @@ func (mg *RateBasedRule) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.InitProvider.Predicate); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicate[i3].DataID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Predicate[i3].DataIDRef, - Selector: mg.Spec.InitProvider.Predicate[i3].DataIDSelector, - To: reference.To{ - List: &IPSetList{}, - Managed: &IPSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("wafregional.aws.upbound.io", + + "v1beta1", + + "IPSet", "IPSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicate[i3].DataID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Predicate[i3].DataIDRef, + Selector: mg.Spec.InitProvider.Predicate[i3].DataIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Predicate[i3].DataID") } @@ -63,22 +87,35 @@ func (mg *RateBasedRule) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this RegexMatchSet. func (mg *RegexMatchSet) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.RegexMatchTuple); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetIDRef, - Selector: mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetIDSelector, - To: reference.To{ - List: &RegexPatternSetList{}, - Managed: &RegexPatternSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("wafregional.aws.upbound.io", + + "v1beta1", + + "RegexPatternSet", + + "RegexPatternSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetIDRef, + Selector: mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.RegexMatchTuple[i3].RegexPatternSetID") } @@ -87,16 +124,26 @@ func (mg *RegexMatchSet) ResolveReferences(ctx context.Context, c client.Reader) } for i3 := 0; i3 < len(mg.Spec.InitProvider.RegexMatchTuple); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetIDRef, - Selector: mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetIDSelector, - To: reference.To{ - List: &RegexPatternSetList{}, - Managed: &RegexPatternSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("wafregional.aws.upbound.io", + + "v1beta1", + + "RegexPatternSet", + + "RegexPatternSetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetIDRef, + Selector: mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.RegexMatchTuple[i3].RegexPatternSetID") } @@ -110,22 +157,34 @@ func (mg *RegexMatchSet) ResolveReferences(ctx context.Context, c client.Reader) // ResolveReferences of this Rule. func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.Predicate); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicate[i3].DataID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Predicate[i3].DataIDRef, - Selector: mg.Spec.ForProvider.Predicate[i3].DataIDSelector, - To: reference.To{ - List: &IPSetList{}, - Managed: &IPSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("wafregional.aws.upbound.io", + + "v1beta1", + + "IPSet", "IPSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Predicate[i3].DataID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Predicate[i3].DataIDRef, + Selector: mg.Spec.ForProvider.Predicate[i3].DataIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Predicate[i3].DataID") } @@ -134,16 +193,25 @@ func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { } for i3 := 0; i3 < len(mg.Spec.InitProvider.Predicate); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicate[i3].DataID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Predicate[i3].DataIDRef, - Selector: mg.Spec.InitProvider.Predicate[i3].DataIDSelector, - To: reference.To{ - List: &IPSetList{}, - Managed: &IPSet{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("wafregional.aws.upbound.io", + + "v1beta1", + + "IPSet", "IPSetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Predicate[i3].DataID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Predicate[i3].DataIDRef, + Selector: mg.Spec.InitProvider.Predicate[i3].DataIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Predicate[i3].DataID") } @@ -157,22 +225,35 @@ func (mg *Rule) ResolveReferences(ctx context.Context, c client.Reader) error { // ResolveReferences of this WebACL. func (mg *WebACL) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error for i3 := 0; i3 < len(mg.Spec.ForProvider.LoggingConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestination), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestinationRef, - Selector: mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestinationSelector, - To: reference.To{ - List: &v1beta1.DeliveryStreamList{}, - Managed: &v1beta1.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestination), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestinationRef, + Selector: mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.LoggingConfiguration[i3].LogDestination") } @@ -181,16 +262,25 @@ func (mg *WebACL) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.ForProvider.Rule); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule[i3].RuleID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.Rule[i3].RuleIDRef, - Selector: mg.Spec.ForProvider.Rule[i3].RuleIDSelector, - To: reference.To{ - List: &RuleList{}, - Managed: &Rule{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("wafregional.aws.upbound.io", + + "v1beta1", + + "Rule", "RuleList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Rule[i3].RuleID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.Rule[i3].RuleIDRef, + Selector: mg.Spec.ForProvider.Rule[i3].RuleIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.Rule[i3].RuleID") } @@ -199,16 +289,26 @@ func (mg *WebACL) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.LoggingConfiguration); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestination), - Extract: resource.ExtractParamPath("arn", false), - Reference: mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestinationRef, - Selector: mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestinationSelector, - To: reference.To{ - List: &v1beta1.DeliveryStreamList{}, - Managed: &v1beta1.DeliveryStream{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("firehose.aws.upbound.io", + + "v1beta1", + + "DeliveryStream", + + "DeliveryStreamList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestination), + Extract: resource.ExtractParamPath("arn", false), + Reference: mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestinationRef, + Selector: mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestinationSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.LoggingConfiguration[i3].LogDestination") } @@ -217,16 +317,25 @@ func (mg *WebACL) ResolveReferences(ctx context.Context, c client.Reader) error } for i3 := 0; i3 < len(mg.Spec.InitProvider.Rule); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule[i3].RuleID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.Rule[i3].RuleIDRef, - Selector: mg.Spec.InitProvider.Rule[i3].RuleIDSelector, - To: reference.To{ - List: &RuleList{}, - Managed: &Rule{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("wafregional.aws.upbound.io", + + "v1beta1", + + "Rule", "RuleList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Rule[i3].RuleID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.Rule[i3].RuleIDRef, + Selector: mg.Spec.InitProvider.Rule[i3].RuleIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.Rule[i3].RuleID") } diff --git a/apis/workspaces/v1beta1/zz_generated.resolvers.go b/apis/workspaces/v1beta1/zz_generated.resolvers.go index 5ee598d8ab..9808061c3f 100644 --- a/apis/workspaces/v1beta1/zz_generated.resolvers.go +++ b/apis/workspaces/v1beta1/zz_generated.resolvers.go @@ -10,45 +10,68 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/ds/v1beta1" - v1beta11 "github.com/upbound/provider-aws/apis/ec2/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this Directory. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this Directory. func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var mrsp reference.MultiResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.DirectoryIDRef, - Selector: mg.Spec.ForProvider.DirectoryIDSelector, - To: reference.To{ - List: &v1beta1.DirectoryList{}, - Managed: &v1beta1.Directory{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.DirectoryIDRef, + Selector: mg.Spec.ForProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.DirectoryID") } mg.Spec.ForProvider.DirectoryID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.DirectoryIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.ForProvider.SubnetIDRefs, - Selector: mg.Spec.ForProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") } @@ -56,16 +79,26 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.ForProvider.WorkspaceCreationProperties); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.ForProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDRef, - Selector: mg.Spec.ForProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.ForProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDRef, + Selector: mg.Spec.ForProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupID") } @@ -73,32 +106,51 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.ForProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDRef = rsp.ResolvedReference } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DirectoryID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.DirectoryIDRef, - Selector: mg.Spec.InitProvider.DirectoryIDSelector, - To: reference.To{ - List: &v1beta1.DirectoryList{}, - Managed: &v1beta1.Directory{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ds.aws.upbound.io", + + "v1beta1", + + "Directory", + "DirectoryList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.DirectoryID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.DirectoryIDRef, + Selector: mg.Spec.InitProvider.DirectoryIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.DirectoryID") } mg.Spec.InitProvider.DirectoryID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.DirectoryIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", - mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ - CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), - Extract: reference.ExternalName(), - References: mg.Spec.InitProvider.SubnetIDRefs, - Selector: mg.Spec.InitProvider.SubnetIDSelector, - To: reference.To{ - List: &v1beta11.SubnetList{}, - Managed: &v1beta11.Subnet{}, - }, - }) + "Subnet", + "SubnetList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") } @@ -106,16 +158,26 @@ func (mg *Directory) ResolveReferences(ctx context.Context, c client.Reader) err mg.Spec.InitProvider.SubnetIDRefs = mrsp.ResolvedReferences for i3 := 0; i3 < len(mg.Spec.InitProvider.WorkspaceCreationProperties); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupID), - Extract: resource.ExtractResourceID(), - Reference: mg.Spec.InitProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDRef, - Selector: mg.Spec.InitProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDSelector, - To: reference.To{ - List: &v1beta11.SecurityGroupList{}, - Managed: &v1beta11.SecurityGroup{}, - }, - }) + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", + + "v1beta1", + + "SecurityGroup", + "SecurityGroupList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDRef, + Selector: mg.Spec.InitProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.WorkspaceCreationProperties[i3].CustomSecurityGroupID") } diff --git a/apis/xray/v1beta1/zz_generated.resolvers.go b/apis/xray/v1beta1/zz_generated.resolvers.go index b4623f5aa9..aa23ac22a6 100644 --- a/apis/xray/v1beta1/zz_generated.resolvers.go +++ b/apis/xray/v1beta1/zz_generated.resolvers.go @@ -10,43 +10,65 @@ import ( reference "github.com/crossplane/crossplane-runtime/pkg/reference" resource "github.com/crossplane/upjet/pkg/resource" errors "github.com/pkg/errors" - v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" + + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" client "sigs.k8s.io/controller-runtime/pkg/client" + + // ResolveReferences of this EncryptionConfig. + apisresolver "github.com/upbound/provider-aws/internal/apis" ) -// ResolveReferences of this EncryptionConfig. func (mg *EncryptionConfig) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) var rsp reference.ResolutionResponse var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", + + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.ForProvider.KeyIDRef, - Selector: mg.Spec.ForProvider.KeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.ForProvider.KeyIDRef, + Selector: mg.Spec.ForProvider.KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.ForProvider.KeyID") } mg.Spec.ForProvider.KeyID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.KeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", + + "v1beta1", - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyID), - Extract: resource.ExtractParamPath("arn", true), - Reference: mg.Spec.InitProvider.KeyIDRef, - Selector: mg.Spec.InitProvider.KeyIDSelector, - To: reference.To{ - List: &v1beta1.KeyList{}, - Managed: &v1beta1.Key{}, - }, - }) + "Key", "KeyList", + ) + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KeyID), + Extract: resource.ExtractParamPath("arn", true), + Reference: mg.Spec.InitProvider.KeyIDRef, + Selector: mg.Spec.InitProvider.KeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } if err != nil { return errors.Wrap(err, "mg.Spec.InitProvider.KeyID") }