-
Notifications
You must be signed in to change notification settings - Fork 118
/
zz_generated.resolvers.go
124 lines (109 loc) · 4.64 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
121
122
123
124
// 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"
client "sigs.k8s.io/controller-runtime/pkg/client"
// ResolveReferences of this Vault.
apisresolver "github.com/upbound/provider-aws/internal/apis"
)
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++ {
{
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")
}
mg.Spec.ForProvider.Notification[i3].SnsTopic = reference.ToPtrValue(rsp.ResolvedValue)
mg.Spec.ForProvider.Notification[i3].SnsTopicRef = rsp.ResolvedReference
}
for i3 := 0; i3 < len(mg.Spec.InitProvider.Notification); i3++ {
{
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")
}
mg.Spec.InitProvider.Notification[i3].SnsTopic = reference.ToPtrValue(rsp.ResolvedValue)
mg.Spec.InitProvider.Notification[i3].SnsTopicRef = rsp.ResolvedReference
}
return nil
}
// 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", "v1beta2", "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: 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", "v1beta2", "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")
}
mg.Spec.InitProvider.VaultName = reference.ToPtrValue(rsp.ResolvedValue)
mg.Spec.InitProvider.VaultNameRef = rsp.ResolvedReference
return nil
}