/
getAccessCredentials.go
285 lines (254 loc) · 12.6 KB
/
getAccessCredentials.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package azure
import (
"context"
"reflect"
"github.com/pulumi/pulumi-vault/sdk/v5/go/vault/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-vault/sdk/v5/go/vault/azure"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := azure.GetAccessCredentials(ctx, &azure.GetAccessCredentialsArgs{
// Role: "my-role",
// ValidateCreds: pulumi.BoolRef(true),
// NumSequentialSuccesses: pulumi.IntRef(8),
// NumSecondsBetweenTests: pulumi.IntRef(1),
// MaxCredValidationSeconds: pulumi.IntRef(300),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ## Caveats
//
// The `validateCreds` option requires read-access to the `backend` config endpoint.
// If the effective Vault role does not have the required permissions then valid values
// are required to be set for: `subscriptionId`, `tenantId`, `environment`.
func GetAccessCredentials(ctx *pulumi.Context, args *GetAccessCredentialsArgs, opts ...pulumi.InvokeOption) (*GetAccessCredentialsResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv GetAccessCredentialsResult
err := ctx.Invoke("vault:azure/getAccessCredentials:getAccessCredentials", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getAccessCredentials.
type GetAccessCredentialsArgs struct {
// The path to the Azure secret backend to
// read credentials from, with no leading or trailing `/`s.
Backend string `pulumi:"backend"`
// The Azure environment to use during credential validation.
// Defaults to the environment configured in the Vault backend.
// Some possible values: `AzurePublicCloud`, `AzureGovernmentCloud`
// *See the caveats section for more information on this field.*
Environment *string `pulumi:"environment"`
// If 'validate_creds' is true,
// the number of seconds after which to give up validating credentials. Defaults
// to 300.
MaxCredValidationSeconds *int `pulumi:"maxCredValidationSeconds"`
// The namespace of the target resource.
// The value should not contain leading or trailing forward slashes.
// The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault#namespace).
// *Available only for Vault Enterprise*.
Namespace *string `pulumi:"namespace"`
// If 'validate_creds' is true,
// the number of seconds to wait between each test of generated credentials.
// Defaults to 1.
NumSecondsBetweenTests *int `pulumi:"numSecondsBetweenTests"`
// If 'validate_creds' is true,
// the number of sequential successes required to validate generated
// credentials. Defaults to 8.
NumSequentialSuccesses *int `pulumi:"numSequentialSuccesses"`
// The name of the Azure secret backend role to read
// credentials from, with no leading or trailing `/`s.
Role string `pulumi:"role"`
// The subscription ID to use during credential
// validation. Defaults to the subscription ID configured in the Vault `backend`.
// *See the caveats section for more information on this field.*
SubscriptionId *string `pulumi:"subscriptionId"`
// The tenant ID to use during credential validation.
// Defaults to the tenant ID configured in the Vault `backend`.
// *See the caveats section for more information on this field.*
TenantId *string `pulumi:"tenantId"`
// Whether generated credentials should be
// validated before being returned. Defaults to `false`, which returns
// credentials without checking whether they have fully propagated throughout
// Azure Active Directory. Designating `true` activates testing.
ValidateCreds *bool `pulumi:"validateCreds"`
}
// A collection of values returned by getAccessCredentials.
type GetAccessCredentialsResult struct {
Backend string `pulumi:"backend"`
// The client id for credentials to query the Azure APIs.
ClientId string `pulumi:"clientId"`
// The client secret for credentials to query the Azure APIs.
ClientSecret string `pulumi:"clientSecret"`
Environment *string `pulumi:"environment"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The duration of the secret lease, in seconds relative
// to the time the data was requested. Once this time has passed any plan
// generated with this data may fail to apply.
LeaseDuration int `pulumi:"leaseDuration"`
// The lease identifier assigned by Vault.
LeaseId string `pulumi:"leaseId"`
LeaseRenewable bool `pulumi:"leaseRenewable"`
LeaseStartTime string `pulumi:"leaseStartTime"`
MaxCredValidationSeconds *int `pulumi:"maxCredValidationSeconds"`
Namespace *string `pulumi:"namespace"`
NumSecondsBetweenTests *int `pulumi:"numSecondsBetweenTests"`
NumSequentialSuccesses *int `pulumi:"numSequentialSuccesses"`
Role string `pulumi:"role"`
SubscriptionId *string `pulumi:"subscriptionId"`
TenantId *string `pulumi:"tenantId"`
ValidateCreds *bool `pulumi:"validateCreds"`
}
func GetAccessCredentialsOutput(ctx *pulumi.Context, args GetAccessCredentialsOutputArgs, opts ...pulumi.InvokeOption) GetAccessCredentialsResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetAccessCredentialsResult, error) {
args := v.(GetAccessCredentialsArgs)
r, err := GetAccessCredentials(ctx, &args, opts...)
var s GetAccessCredentialsResult
if r != nil {
s = *r
}
return s, err
}).(GetAccessCredentialsResultOutput)
}
// A collection of arguments for invoking getAccessCredentials.
type GetAccessCredentialsOutputArgs struct {
// The path to the Azure secret backend to
// read credentials from, with no leading or trailing `/`s.
Backend pulumi.StringInput `pulumi:"backend"`
// The Azure environment to use during credential validation.
// Defaults to the environment configured in the Vault backend.
// Some possible values: `AzurePublicCloud`, `AzureGovernmentCloud`
// *See the caveats section for more information on this field.*
Environment pulumi.StringPtrInput `pulumi:"environment"`
// If 'validate_creds' is true,
// the number of seconds after which to give up validating credentials. Defaults
// to 300.
MaxCredValidationSeconds pulumi.IntPtrInput `pulumi:"maxCredValidationSeconds"`
// The namespace of the target resource.
// The value should not contain leading or trailing forward slashes.
// The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault#namespace).
// *Available only for Vault Enterprise*.
Namespace pulumi.StringPtrInput `pulumi:"namespace"`
// If 'validate_creds' is true,
// the number of seconds to wait between each test of generated credentials.
// Defaults to 1.
NumSecondsBetweenTests pulumi.IntPtrInput `pulumi:"numSecondsBetweenTests"`
// If 'validate_creds' is true,
// the number of sequential successes required to validate generated
// credentials. Defaults to 8.
NumSequentialSuccesses pulumi.IntPtrInput `pulumi:"numSequentialSuccesses"`
// The name of the Azure secret backend role to read
// credentials from, with no leading or trailing `/`s.
Role pulumi.StringInput `pulumi:"role"`
// The subscription ID to use during credential
// validation. Defaults to the subscription ID configured in the Vault `backend`.
// *See the caveats section for more information on this field.*
SubscriptionId pulumi.StringPtrInput `pulumi:"subscriptionId"`
// The tenant ID to use during credential validation.
// Defaults to the tenant ID configured in the Vault `backend`.
// *See the caveats section for more information on this field.*
TenantId pulumi.StringPtrInput `pulumi:"tenantId"`
// Whether generated credentials should be
// validated before being returned. Defaults to `false`, which returns
// credentials without checking whether they have fully propagated throughout
// Azure Active Directory. Designating `true` activates testing.
ValidateCreds pulumi.BoolPtrInput `pulumi:"validateCreds"`
}
func (GetAccessCredentialsOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetAccessCredentialsArgs)(nil)).Elem()
}
// A collection of values returned by getAccessCredentials.
type GetAccessCredentialsResultOutput struct{ *pulumi.OutputState }
func (GetAccessCredentialsResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetAccessCredentialsResult)(nil)).Elem()
}
func (o GetAccessCredentialsResultOutput) ToGetAccessCredentialsResultOutput() GetAccessCredentialsResultOutput {
return o
}
func (o GetAccessCredentialsResultOutput) ToGetAccessCredentialsResultOutputWithContext(ctx context.Context) GetAccessCredentialsResultOutput {
return o
}
func (o GetAccessCredentialsResultOutput) Backend() pulumi.StringOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) string { return v.Backend }).(pulumi.StringOutput)
}
// The client id for credentials to query the Azure APIs.
func (o GetAccessCredentialsResultOutput) ClientId() pulumi.StringOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) string { return v.ClientId }).(pulumi.StringOutput)
}
// The client secret for credentials to query the Azure APIs.
func (o GetAccessCredentialsResultOutput) ClientSecret() pulumi.StringOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) string { return v.ClientSecret }).(pulumi.StringOutput)
}
func (o GetAccessCredentialsResultOutput) Environment() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) *string { return v.Environment }).(pulumi.StringPtrOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetAccessCredentialsResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) string { return v.Id }).(pulumi.StringOutput)
}
// The duration of the secret lease, in seconds relative
// to the time the data was requested. Once this time has passed any plan
// generated with this data may fail to apply.
func (o GetAccessCredentialsResultOutput) LeaseDuration() pulumi.IntOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) int { return v.LeaseDuration }).(pulumi.IntOutput)
}
// The lease identifier assigned by Vault.
func (o GetAccessCredentialsResultOutput) LeaseId() pulumi.StringOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) string { return v.LeaseId }).(pulumi.StringOutput)
}
func (o GetAccessCredentialsResultOutput) LeaseRenewable() pulumi.BoolOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) bool { return v.LeaseRenewable }).(pulumi.BoolOutput)
}
func (o GetAccessCredentialsResultOutput) LeaseStartTime() pulumi.StringOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) string { return v.LeaseStartTime }).(pulumi.StringOutput)
}
func (o GetAccessCredentialsResultOutput) MaxCredValidationSeconds() pulumi.IntPtrOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) *int { return v.MaxCredValidationSeconds }).(pulumi.IntPtrOutput)
}
func (o GetAccessCredentialsResultOutput) Namespace() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) *string { return v.Namespace }).(pulumi.StringPtrOutput)
}
func (o GetAccessCredentialsResultOutput) NumSecondsBetweenTests() pulumi.IntPtrOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) *int { return v.NumSecondsBetweenTests }).(pulumi.IntPtrOutput)
}
func (o GetAccessCredentialsResultOutput) NumSequentialSuccesses() pulumi.IntPtrOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) *int { return v.NumSequentialSuccesses }).(pulumi.IntPtrOutput)
}
func (o GetAccessCredentialsResultOutput) Role() pulumi.StringOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) string { return v.Role }).(pulumi.StringOutput)
}
func (o GetAccessCredentialsResultOutput) SubscriptionId() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) *string { return v.SubscriptionId }).(pulumi.StringPtrOutput)
}
func (o GetAccessCredentialsResultOutput) TenantId() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) *string { return v.TenantId }).(pulumi.StringPtrOutput)
}
func (o GetAccessCredentialsResultOutput) ValidateCreds() pulumi.BoolPtrOutput {
return o.ApplyT(func(v GetAccessCredentialsResult) *bool { return v.ValidateCreds }).(pulumi.BoolPtrOutput)
}
func init() {
pulumi.RegisterOutputType(GetAccessCredentialsResultOutput{})
}