generated from pulumi/pulumi-tf-provider-boilerplate
/
schedulerConfig.go
283 lines (234 loc) · 11 KB
/
schedulerConfig.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
// 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 nomad
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages scheduler configuration of the Nomad cluster.
//
// > **Warning:** destroying this resource will not have any effect in the
// cluster configuration, since there's no clear definition of what a destroy
// action should do. The cluster will be left as-is and only the state reference
// will be removed.
//
// ## Example Usage
//
// Set cluster scheduler configuration:
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-nomad/sdk/go/nomad"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := nomad.NewSchedulerConfig(ctx, "config", &nomad.SchedulerConfigArgs{
// MemoryOversubscriptionEnabled: pulumi.Bool(true),
// PreemptionConfig: pulumi.BoolMap{
// "batch_scheduler_enabled": pulumi.Bool(true),
// "service_scheduler_enabled": pulumi.Bool(true),
// "sysbatch_scheduler_enabled": pulumi.Bool(true),
// "system_scheduler_enabled": pulumi.Bool(true),
// },
// SchedulerAlgorithm: pulumi.String("spread"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type SchedulerConfig struct {
pulumi.CustomResourceState
// `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
MemoryOversubscriptionEnabled pulumi.BoolPtrOutput `pulumi:"memoryOversubscriptionEnabled"`
// `(map[string]bool)` - Options to enable preemption for various schedulers.
PreemptionConfig pulumi.BoolMapOutput `pulumi:"preemptionConfig"`
// `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
SchedulerAlgorithm pulumi.StringPtrOutput `pulumi:"schedulerAlgorithm"`
}
// NewSchedulerConfig registers a new resource with the given unique name, arguments, and options.
func NewSchedulerConfig(ctx *pulumi.Context,
name string, args *SchedulerConfigArgs, opts ...pulumi.ResourceOption) (*SchedulerConfig, error) {
if args == nil {
args = &SchedulerConfigArgs{}
}
var resource SchedulerConfig
err := ctx.RegisterResource("nomad:index/schedulerConfig:SchedulerConfig", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSchedulerConfig gets an existing SchedulerConfig resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetSchedulerConfig(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SchedulerConfigState, opts ...pulumi.ResourceOption) (*SchedulerConfig, error) {
var resource SchedulerConfig
err := ctx.ReadResource("nomad:index/schedulerConfig:SchedulerConfig", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SchedulerConfig resources.
type schedulerConfigState struct {
// `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
MemoryOversubscriptionEnabled *bool `pulumi:"memoryOversubscriptionEnabled"`
// `(map[string]bool)` - Options to enable preemption for various schedulers.
PreemptionConfig map[string]bool `pulumi:"preemptionConfig"`
// `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
SchedulerAlgorithm *string `pulumi:"schedulerAlgorithm"`
}
type SchedulerConfigState struct {
// `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
MemoryOversubscriptionEnabled pulumi.BoolPtrInput
// `(map[string]bool)` - Options to enable preemption for various schedulers.
PreemptionConfig pulumi.BoolMapInput
// `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
SchedulerAlgorithm pulumi.StringPtrInput
}
func (SchedulerConfigState) ElementType() reflect.Type {
return reflect.TypeOf((*schedulerConfigState)(nil)).Elem()
}
type schedulerConfigArgs struct {
// `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
MemoryOversubscriptionEnabled *bool `pulumi:"memoryOversubscriptionEnabled"`
// `(map[string]bool)` - Options to enable preemption for various schedulers.
PreemptionConfig map[string]bool `pulumi:"preemptionConfig"`
// `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
SchedulerAlgorithm *string `pulumi:"schedulerAlgorithm"`
}
// The set of arguments for constructing a SchedulerConfig resource.
type SchedulerConfigArgs struct {
// `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
MemoryOversubscriptionEnabled pulumi.BoolPtrInput
// `(map[string]bool)` - Options to enable preemption for various schedulers.
PreemptionConfig pulumi.BoolMapInput
// `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
SchedulerAlgorithm pulumi.StringPtrInput
}
func (SchedulerConfigArgs) ElementType() reflect.Type {
return reflect.TypeOf((*schedulerConfigArgs)(nil)).Elem()
}
type SchedulerConfigInput interface {
pulumi.Input
ToSchedulerConfigOutput() SchedulerConfigOutput
ToSchedulerConfigOutputWithContext(ctx context.Context) SchedulerConfigOutput
}
func (*SchedulerConfig) ElementType() reflect.Type {
return reflect.TypeOf((**SchedulerConfig)(nil)).Elem()
}
func (i *SchedulerConfig) ToSchedulerConfigOutput() SchedulerConfigOutput {
return i.ToSchedulerConfigOutputWithContext(context.Background())
}
func (i *SchedulerConfig) ToSchedulerConfigOutputWithContext(ctx context.Context) SchedulerConfigOutput {
return pulumi.ToOutputWithContext(ctx, i).(SchedulerConfigOutput)
}
// SchedulerConfigArrayInput is an input type that accepts SchedulerConfigArray and SchedulerConfigArrayOutput values.
// You can construct a concrete instance of `SchedulerConfigArrayInput` via:
//
// SchedulerConfigArray{ SchedulerConfigArgs{...} }
type SchedulerConfigArrayInput interface {
pulumi.Input
ToSchedulerConfigArrayOutput() SchedulerConfigArrayOutput
ToSchedulerConfigArrayOutputWithContext(context.Context) SchedulerConfigArrayOutput
}
type SchedulerConfigArray []SchedulerConfigInput
func (SchedulerConfigArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SchedulerConfig)(nil)).Elem()
}
func (i SchedulerConfigArray) ToSchedulerConfigArrayOutput() SchedulerConfigArrayOutput {
return i.ToSchedulerConfigArrayOutputWithContext(context.Background())
}
func (i SchedulerConfigArray) ToSchedulerConfigArrayOutputWithContext(ctx context.Context) SchedulerConfigArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SchedulerConfigArrayOutput)
}
// SchedulerConfigMapInput is an input type that accepts SchedulerConfigMap and SchedulerConfigMapOutput values.
// You can construct a concrete instance of `SchedulerConfigMapInput` via:
//
// SchedulerConfigMap{ "key": SchedulerConfigArgs{...} }
type SchedulerConfigMapInput interface {
pulumi.Input
ToSchedulerConfigMapOutput() SchedulerConfigMapOutput
ToSchedulerConfigMapOutputWithContext(context.Context) SchedulerConfigMapOutput
}
type SchedulerConfigMap map[string]SchedulerConfigInput
func (SchedulerConfigMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SchedulerConfig)(nil)).Elem()
}
func (i SchedulerConfigMap) ToSchedulerConfigMapOutput() SchedulerConfigMapOutput {
return i.ToSchedulerConfigMapOutputWithContext(context.Background())
}
func (i SchedulerConfigMap) ToSchedulerConfigMapOutputWithContext(ctx context.Context) SchedulerConfigMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SchedulerConfigMapOutput)
}
type SchedulerConfigOutput struct{ *pulumi.OutputState }
func (SchedulerConfigOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SchedulerConfig)(nil)).Elem()
}
func (o SchedulerConfigOutput) ToSchedulerConfigOutput() SchedulerConfigOutput {
return o
}
func (o SchedulerConfigOutput) ToSchedulerConfigOutputWithContext(ctx context.Context) SchedulerConfigOutput {
return o
}
// `(bool: false)` - When `true`, tasks may exceed their reserved memory limit.
func (o SchedulerConfigOutput) MemoryOversubscriptionEnabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *SchedulerConfig) pulumi.BoolPtrOutput { return v.MemoryOversubscriptionEnabled }).(pulumi.BoolPtrOutput)
}
// `(map[string]bool)` - Options to enable preemption for various schedulers.
func (o SchedulerConfigOutput) PreemptionConfig() pulumi.BoolMapOutput {
return o.ApplyT(func(v *SchedulerConfig) pulumi.BoolMapOutput { return v.PreemptionConfig }).(pulumi.BoolMapOutput)
}
// `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are `binpack` and `spread`.
func (o SchedulerConfigOutput) SchedulerAlgorithm() pulumi.StringPtrOutput {
return o.ApplyT(func(v *SchedulerConfig) pulumi.StringPtrOutput { return v.SchedulerAlgorithm }).(pulumi.StringPtrOutput)
}
type SchedulerConfigArrayOutput struct{ *pulumi.OutputState }
func (SchedulerConfigArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SchedulerConfig)(nil)).Elem()
}
func (o SchedulerConfigArrayOutput) ToSchedulerConfigArrayOutput() SchedulerConfigArrayOutput {
return o
}
func (o SchedulerConfigArrayOutput) ToSchedulerConfigArrayOutputWithContext(ctx context.Context) SchedulerConfigArrayOutput {
return o
}
func (o SchedulerConfigArrayOutput) Index(i pulumi.IntInput) SchedulerConfigOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SchedulerConfig {
return vs[0].([]*SchedulerConfig)[vs[1].(int)]
}).(SchedulerConfigOutput)
}
type SchedulerConfigMapOutput struct{ *pulumi.OutputState }
func (SchedulerConfigMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SchedulerConfig)(nil)).Elem()
}
func (o SchedulerConfigMapOutput) ToSchedulerConfigMapOutput() SchedulerConfigMapOutput {
return o
}
func (o SchedulerConfigMapOutput) ToSchedulerConfigMapOutputWithContext(ctx context.Context) SchedulerConfigMapOutput {
return o
}
func (o SchedulerConfigMapOutput) MapIndex(k pulumi.StringInput) SchedulerConfigOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SchedulerConfig {
return vs[0].(map[string]*SchedulerConfig)[vs[1].(string)]
}).(SchedulerConfigOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SchedulerConfigInput)(nil)).Elem(), &SchedulerConfig{})
pulumi.RegisterInputType(reflect.TypeOf((*SchedulerConfigArrayInput)(nil)).Elem(), SchedulerConfigArray{})
pulumi.RegisterInputType(reflect.TypeOf((*SchedulerConfigMapInput)(nil)).Elem(), SchedulerConfigMap{})
pulumi.RegisterOutputType(SchedulerConfigOutput{})
pulumi.RegisterOutputType(SchedulerConfigArrayOutput{})
pulumi.RegisterOutputType(SchedulerConfigMapOutput{})
}