/
provider.go
executable file
·217 lines (183 loc) · 7.74 KB
/
provider.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package proxmox
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The provider type for the proxmox package. By default, resources use package-wide configuration
// settings, however an explicit `Provider` instance may be created and passed during resource
// construction to achieve fine-grained programmatic control over provider settings. See the
// [documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.
type Provider struct {
pulumi.ProviderResourceState
// API TokenID e.g. root@pam!mytesttoken
PmApiTokenId pulumi.StringPtrOutput `pulumi:"pmApiTokenId"`
// The secret uuid corresponding to a TokenID
PmApiTokenSecret pulumi.StringPtrOutput `pulumi:"pmApiTokenSecret"`
// https://host.fqdn:8006/api2/json
PmApiUrl pulumi.StringOutput `pulumi:"pmApiUrl"`
// Write logs to this specific file
PmLogFile pulumi.StringPtrOutput `pulumi:"pmLogFile"`
// OTP 2FA code (if required)
PmOtp pulumi.StringPtrOutput `pulumi:"pmOtp"`
// Password to authenticate into proxmox
PmPassword pulumi.StringPtrOutput `pulumi:"pmPassword"`
// Username e.g. myuser or myuser@pam
PmUser pulumi.StringPtrOutput `pulumi:"pmUser"`
}
// NewProvider registers a new resource with the given unique name, arguments, and options.
func NewProvider(ctx *pulumi.Context,
name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.PmApiUrl == nil {
return nil, errors.New("invalid value for required argument 'PmApiUrl'")
}
var resource Provider
err := ctx.RegisterResource("pulumi:providers:proxmox", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type providerArgs struct {
// API TokenID e.g. root@pam!mytesttoken
PmApiTokenId *string `pulumi:"pmApiTokenId"`
// The secret uuid corresponding to a TokenID
PmApiTokenSecret *string `pulumi:"pmApiTokenSecret"`
// https://host.fqdn:8006/api2/json
PmApiUrl string `pulumi:"pmApiUrl"`
// By default this provider will exit if an unknown attribute is found. This is to prevent the accidential destruction of
// VMs or Data when something in the proxmox API has changed/updated and is not confirmed to work with this provider. Set
// this to true at your own risk. It may allow you to proceed in cases when the provider refuses to work, but be aware of
// the danger in doing so.
PmDangerouslyIgnoreUnknownAttributes *bool `pulumi:"pmDangerouslyIgnoreUnknownAttributes"`
// Enable provider logging to get proxmox API logs
PmLogEnable *bool `pulumi:"pmLogEnable"`
// Write logs to this specific file
PmLogFile *string `pulumi:"pmLogFile"`
// Configure the logging level to display; trace, debug, info, warn, etc
PmLogLevels map[string]interface{} `pulumi:"pmLogLevels"`
// OTP 2FA code (if required)
PmOtp *string `pulumi:"pmOtp"`
PmParallel *int `pulumi:"pmParallel"`
// Password to authenticate into proxmox
PmPassword *string `pulumi:"pmPassword"`
PmTimeout *int `pulumi:"pmTimeout"`
// By default, every TLS connection is verified to be secure. This option allows terraform to proceed and operate on
// servers considered insecure. For example if you're connecting to a remote host and you do not have the CA cert that
// issued the proxmox api url's certificate.
PmTlsInsecure *bool `pulumi:"pmTlsInsecure"`
// Username e.g. myuser or myuser@pam
PmUser *string `pulumi:"pmUser"`
}
// The set of arguments for constructing a Provider resource.
type ProviderArgs struct {
// API TokenID e.g. root@pam!mytesttoken
PmApiTokenId pulumi.StringPtrInput
// The secret uuid corresponding to a TokenID
PmApiTokenSecret pulumi.StringPtrInput
// https://host.fqdn:8006/api2/json
PmApiUrl pulumi.StringInput
// By default this provider will exit if an unknown attribute is found. This is to prevent the accidential destruction of
// VMs or Data when something in the proxmox API has changed/updated and is not confirmed to work with this provider. Set
// this to true at your own risk. It may allow you to proceed in cases when the provider refuses to work, but be aware of
// the danger in doing so.
PmDangerouslyIgnoreUnknownAttributes pulumi.BoolPtrInput
// Enable provider logging to get proxmox API logs
PmLogEnable pulumi.BoolPtrInput
// Write logs to this specific file
PmLogFile pulumi.StringPtrInput
// Configure the logging level to display; trace, debug, info, warn, etc
PmLogLevels pulumi.MapInput
// OTP 2FA code (if required)
PmOtp pulumi.StringPtrInput
PmParallel pulumi.IntPtrInput
// Password to authenticate into proxmox
PmPassword pulumi.StringPtrInput
PmTimeout pulumi.IntPtrInput
// By default, every TLS connection is verified to be secure. This option allows terraform to proceed and operate on
// servers considered insecure. For example if you're connecting to a remote host and you do not have the CA cert that
// issued the proxmox api url's certificate.
PmTlsInsecure pulumi.BoolPtrInput
// Username e.g. myuser or myuser@pam
PmUser pulumi.StringPtrInput
}
func (ProviderArgs) ElementType() reflect.Type {
return reflect.TypeOf((*providerArgs)(nil)).Elem()
}
type ProviderInput interface {
pulumi.Input
ToProviderOutput() ProviderOutput
ToProviderOutputWithContext(ctx context.Context) ProviderOutput
}
func (*Provider) ElementType() reflect.Type {
return reflect.TypeOf((*Provider)(nil))
}
func (i *Provider) ToProviderOutput() ProviderOutput {
return i.ToProviderOutputWithContext(context.Background())
}
func (i *Provider) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProviderOutput)
}
func (i *Provider) ToProviderPtrOutput() ProviderPtrOutput {
return i.ToProviderPtrOutputWithContext(context.Background())
}
func (i *Provider) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProviderPtrOutput)
}
type ProviderPtrInput interface {
pulumi.Input
ToProviderPtrOutput() ProviderPtrOutput
ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput
}
type providerPtrType ProviderArgs
func (*providerPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Provider)(nil))
}
func (i *providerPtrType) ToProviderPtrOutput() ProviderPtrOutput {
return i.ToProviderPtrOutputWithContext(context.Background())
}
func (i *providerPtrType) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProviderPtrOutput)
}
type ProviderOutput struct {
*pulumi.OutputState
}
func (ProviderOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Provider)(nil))
}
func (o ProviderOutput) ToProviderOutput() ProviderOutput {
return o
}
func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
return o
}
func (o ProviderOutput) ToProviderPtrOutput() ProviderPtrOutput {
return o.ToProviderPtrOutputWithContext(context.Background())
}
func (o ProviderOutput) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
return o.ApplyT(func(v Provider) *Provider {
return &v
}).(ProviderPtrOutput)
}
type ProviderPtrOutput struct {
*pulumi.OutputState
}
func (ProviderPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Provider)(nil))
}
func (o ProviderPtrOutput) ToProviderPtrOutput() ProviderPtrOutput {
return o
}
func (o ProviderPtrOutput) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
return o
}
func init() {
pulumi.RegisterOutputType(ProviderOutput{})
pulumi.RegisterOutputType(ProviderPtrOutput{})
}