-
Notifications
You must be signed in to change notification settings - Fork 121
/
zz_generated.resolvers.go
136 lines (117 loc) · 4.07 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
/*
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"
v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1"
common "github.com/upbound/provider-aws/config/common"
resource "github.com/upbound/upjet/pkg/resource"
client "sigs.k8s.io/controller-runtime/pkg/client"
)
// ResolveReferences of this App.
func (mg *App) 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.IAMServiceRoleArn),
Extract: common.ARNExtractor(),
Reference: mg.Spec.ForProvider.IAMServiceRoleArnRef,
Selector: mg.Spec.ForProvider.IAMServiceRoleArnSelector,
To: reference.To{
List: &v1beta1.RoleList{},
Managed: &v1beta1.Role{},
},
})
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
return nil
}
// ResolveReferences of this BackendEnvironment.
func (mg *BackendEnvironment) 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.AppID),
Extract: resource.ExtractResourceID(),
Reference: mg.Spec.ForProvider.AppIDRef,
Selector: mg.Spec.ForProvider.AppIDSelector,
To: reference.To{
List: &AppList{},
Managed: &App{},
},
})
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
return nil
}
// ResolveReferences of this Branch.
func (mg *Branch) 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.AppID),
Extract: resource.ExtractResourceID(),
Reference: mg.Spec.ForProvider.AppIDRef,
Selector: mg.Spec.ForProvider.AppIDSelector,
To: reference.To{
List: &AppList{},
Managed: &App{},
},
})
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
return nil
}
// ResolveReferences of this Webhook.
func (mg *Webhook) 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.AppID),
Extract: resource.ExtractResourceID(),
Reference: mg.Spec.ForProvider.AppIDRef,
Selector: mg.Spec.ForProvider.AppIDSelector,
To: reference.To{
List: &AppList{},
Managed: &App{},
},
})
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
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{},
},
})
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
return nil
}