-
Notifications
You must be signed in to change notification settings - Fork 121
/
zz_generated.resolvers.go
168 lines (147 loc) · 5.52 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
Copyright 2022 Upbound Inc.
*/
// Code generated by angryjet. DO NOT EDIT.
package v1beta1
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/kms/v1beta1"
client "sigs.k8s.io/controller-runtime/pkg/client"
)
// ResolveReferences of this Cluster.
func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error {
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.ParameterGroupName),
Extract: reference.ExternalName(),
Reference: mg.Spec.ForProvider.ParameterGroupNameRef,
Selector: mg.Spec.ForProvider.ParameterGroupNameSelector,
To: reference.To{
List: &ParameterGroupList{},
Managed: &ParameterGroup{},
},
})
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
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{},
},
})
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
return nil
}
// ResolveReferences of this ReplicationGroup.
func (mg *ReplicationGroup) ResolveReferences(ctx context.Context, c client.Reader) error {
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{},
},
})
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{},
},
})
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
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{},
},
})
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
return nil
}
// ResolveReferences of this SubnetGroup.
func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error {
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: &v1beta11.SubnetList{},
Managed: &v1beta11.Subnet{},
},
})
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
return nil
}
// ResolveReferences of this UserGroup.
func (mg *UserGroup) ResolveReferences(ctx context.Context, c client.Reader) error {
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{},
},
})
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
return nil
}