-
-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathterraform_output_utils.go
More file actions
189 lines (135 loc) · 7.08 KB
/
terraform_output_utils.go
File metadata and controls
189 lines (135 loc) · 7.08 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
package exec
import (
"context"
"fmt"
errUtils "github.com/cloudposse/atmos/errors"
auth_types "github.com/cloudposse/atmos/pkg/auth/types"
"github.com/cloudposse/atmos/pkg/perf"
"github.com/cloudposse/atmos/pkg/schema"
)
// authContextWrapper is a minimal AuthManager implementation that only provides
// GetStackInfo() for passing AuthContext to ExecuteDescribeComponent.
// Other methods panic if called since this wrapper is only for propagating existing auth context.
type authContextWrapper struct {
stackInfo *schema.ConfigAndStacksInfo
}
func (a *authContextWrapper) GetStackInfo() *schema.ConfigAndStacksInfo {
defer perf.Track(nil, "exec.authContextWrapper.GetStackInfo")()
return a.stackInfo
}
// Stub methods to satisfy AuthManager interface (not used by ExecuteDescribeComponent).
func (a *authContextWrapper) GetCachedCredentials(ctx context.Context, identityName string) (*auth_types.WhoamiInfo, error) {
defer perf.Track(nil, "exec.authContextWrapper.GetCachedCredentials")()
panic("authContextWrapper.GetCachedCredentials should not be called")
}
func (a *authContextWrapper) Authenticate(ctx context.Context, identityName string) (*auth_types.WhoamiInfo, error) {
defer perf.Track(nil, "exec.authContextWrapper.Authenticate")()
panic("authContextWrapper.Authenticate should not be called")
}
func (a *authContextWrapper) AuthenticateProvider(ctx context.Context, providerName string) (*auth_types.WhoamiInfo, error) {
defer perf.Track(nil, "exec.authContextWrapper.AuthenticateProvider")()
return nil, fmt.Errorf("%w: authContextWrapper.AuthenticateProvider for template context", errUtils.ErrNotImplemented)
}
func (a *authContextWrapper) Whoami(ctx context.Context, identityName string) (*auth_types.WhoamiInfo, error) {
defer perf.Track(nil, "exec.authContextWrapper.Whoami")()
panic("authContextWrapper.Whoami should not be called")
}
func (a *authContextWrapper) Validate() error {
defer perf.Track(nil, "exec.authContextWrapper.Validate")()
panic("authContextWrapper.Validate should not be called")
}
func (a *authContextWrapper) GetDefaultIdentity(forceSelect bool) (string, error) {
defer perf.Track(nil, "exec.authContextWrapper.GetDefaultIdentity")()
panic("authContextWrapper.GetDefaultIdentity should not be called")
}
func (a *authContextWrapper) ListProviders() []string {
defer perf.Track(nil, "exec.authContextWrapper.ListProviders")()
panic("authContextWrapper.ListProviders should not be called")
}
func (a *authContextWrapper) Logout(ctx context.Context, identityName string, deleteKeychain bool) error {
defer perf.Track(nil, "exec.authContextWrapper.Logout")()
panic("authContextWrapper.Logout should not be called")
}
func (a *authContextWrapper) GetChain() []string {
defer perf.Track(nil, "exec.authContextWrapper.GetChain")()
// Return empty slice instead of panicking.
// This wrapper doesn't track the authentication chain; it only propagates auth context.
// When used in resolveAuthManagerForNestedComponent, an empty chain means
// no inherited identity, so the component will use its own defaults.
return []string{}
}
func (a *authContextWrapper) ListIdentities() []string {
defer perf.Track(nil, "exec.authContextWrapper.ListIdentities")()
panic("authContextWrapper.ListIdentities should not be called")
}
func (a *authContextWrapper) GetProviderForIdentity(identityName string) string {
defer perf.Track(nil, "exec.authContextWrapper.GetProviderForIdentity")()
panic("authContextWrapper.GetProviderForIdentity should not be called")
}
func (a *authContextWrapper) GetFilesDisplayPath(providerName string) string {
defer perf.Track(nil, "exec.authContextWrapper.GetFilesDisplayPath")()
panic("authContextWrapper.GetFilesDisplayPath should not be called")
}
func (a *authContextWrapper) GetProviderKindForIdentity(identityName string) (string, error) {
defer perf.Track(nil, "exec.authContextWrapper.GetProviderKindForIdentity")()
panic("authContextWrapper.GetProviderKindForIdentity should not be called")
}
func (a *authContextWrapper) GetIdentities() map[string]schema.Identity {
defer perf.Track(nil, "exec.authContextWrapper.GetIdentities")()
panic("authContextWrapper.GetIdentities should not be called")
}
func (a *authContextWrapper) GetProviders() map[string]schema.Provider {
defer perf.Track(nil, "exec.authContextWrapper.GetProviders")()
panic("authContextWrapper.GetProviders should not be called")
}
func (a *authContextWrapper) LogoutProvider(ctx context.Context, providerName string, deleteKeychain bool) error {
defer perf.Track(nil, "exec.authContextWrapper.LogoutProvider")()
panic("authContextWrapper.LogoutProvider should not be called")
}
func (a *authContextWrapper) LogoutAll(ctx context.Context, deleteKeychain bool) error {
defer perf.Track(nil, "exec.authContextWrapper.LogoutAll")()
panic("authContextWrapper.LogoutAll should not be called")
}
func (a *authContextWrapper) GetEnvironmentVariables(identityName string) (map[string]string, error) {
defer perf.Track(nil, "exec.authContextWrapper.GetEnvironmentVariables")()
panic("authContextWrapper.GetEnvironmentVariables should not be called")
}
func (a *authContextWrapper) PrepareShellEnvironment(ctx context.Context, identityName string, currentEnv []string) ([]string, error) {
defer perf.Track(nil, "exec.authContextWrapper.PrepareShellEnvironment")()
panic("authContextWrapper.PrepareShellEnvironment should not be called")
}
func (a *authContextWrapper) ExecuteIntegration(ctx context.Context, integrationName string) error {
defer perf.Track(nil, "exec.authContextWrapper.ExecuteIntegration")()
panic("authContextWrapper.ExecuteIntegration should not be called")
}
func (a *authContextWrapper) ExecuteIdentityIntegrations(ctx context.Context, identityName string) error {
defer perf.Track(nil, "exec.authContextWrapper.ExecuteIdentityIntegrations")()
panic("authContextWrapper.ExecuteIdentityIntegrations should not be called")
}
func (a *authContextWrapper) GetIntegration(integrationName string) (*schema.Integration, error) {
defer perf.Track(nil, "exec.authContextWrapper.GetIntegration")()
panic("authContextWrapper.GetIntegration should not be called")
}
func (a *authContextWrapper) ResolvePrincipalSetting(identityName, key string) (interface{}, bool) {
defer perf.Track(nil, "exec.authContextWrapper.ResolvePrincipalSetting")()
// Return false - this wrapper doesn't have access to identity/provider configuration.
// It only propagates existing auth context for nested component resolution.
return nil, false
}
func (a *authContextWrapper) ResolveProviderConfig(identityName string) (*schema.Provider, bool) {
defer perf.Track(nil, "exec.authContextWrapper.ResolveProviderConfig")()
// Return false - this wrapper doesn't have access to provider configuration.
// It only propagates existing auth context for nested component resolution.
return nil, false
}
// newAuthContextWrapper creates an AuthManager wrapper that returns the given AuthContext.
func newAuthContextWrapper(authContext *schema.AuthContext) *authContextWrapper {
if authContext == nil {
return nil
}
return &authContextWrapper{
stackInfo: &schema.ConfigAndStacksInfo{
AuthContext: authContext,
},
}
}