-
Notifications
You must be signed in to change notification settings - Fork 121
/
zz_generated.resolvers.go
120 lines (109 loc) · 5.37 KB
/
zz_generated.resolvers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io>
//
// SPDX-License-Identifier: Apache-2.0
// Code generated by angryjet. DO NOT EDIT.
// Code transformed by upjet. DO NOT EDIT.
package v1beta1
import (
"context"
reference "github.com/crossplane/crossplane-runtime/pkg/reference"
resource "github.com/crossplane/upjet/pkg/resource"
errors "github.com/pkg/errors"
xpresource "github.com/crossplane/crossplane-runtime/pkg/resource"
common "github.com/upbound/provider-aws/config/common"
apisresolver "github.com/upbound/provider-aws/internal/apis"
client "sigs.k8s.io/controller-runtime/pkg/client"
)
func (mg *LifecyclePolicy) ResolveReferences( // ResolveReferences of this LifecyclePolicy.
ctx context.Context, c client.Reader) error {
var 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.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
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++ {
{
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")
}
mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArn = reference.ToPtrValue(rsp.ResolvedValue)
mg.Spec.ForProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnRef = 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.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")
}
mg.Spec.InitProvider.ExecutionRoleArn = reference.ToPtrValue(rsp.ResolvedValue)
mg.Spec.InitProvider.ExecutionRoleArnRef = rsp.ResolvedReference
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++ {
{
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")
}
mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArn = reference.ToPtrValue(rsp.ResolvedValue)
mg.Spec.InitProvider.PolicyDetails[i3].Schedule[i4].CrossRegionCopyRule[i5].CmkArnRef = rsp.ResolvedReference
}
}
}
return nil
}