/
workerPool.go
198 lines (164 loc) · 8.45 KB
/
workerPool.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
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a `WorkerPool` to run the builds, and returns the new worker pool.
type WorkerPool struct {
pulumi.CustomResourceState
// Time at which the request to create the `WorkerPool` was received.
CreateTime pulumi.StringOutput `pulumi:"createTime"`
// Time at which the request to delete the `WorkerPool` was received.
DeleteTime pulumi.StringOutput `pulumi:"deleteTime"`
// User-defined name of the `WorkerPool`.
Name pulumi.StringOutput `pulumi:"name"`
Project pulumi.StringOutput `pulumi:"project"`
// List of regions to create the `WorkerPool`. Regions can't be empty. If Cloud Build adds a new GCP region in the future, the existing `WorkerPool` will not be enabled in the new region automatically; you must add the new region to the `regions` field to enable the `WorkerPool` in that region.
Regions pulumi.StringArrayOutput `pulumi:"regions"`
// The service account used to manage the `WorkerPool`. The service account must have the Compute Instance Admin (Beta) permission at the project level.
ServiceAccountEmail pulumi.StringOutput `pulumi:"serviceAccountEmail"`
// WorkerPool Status.
Status pulumi.StringOutput `pulumi:"status"`
// Time at which the request to update the `WorkerPool` was received.
UpdateTime pulumi.StringOutput `pulumi:"updateTime"`
// Configuration to be used for a creating workers in the `WorkerPool`.
WorkerConfig WorkerConfigResponseOutput `pulumi:"workerConfig"`
// Total number of workers to be created across all requested regions.
WorkerCount pulumi.StringOutput `pulumi:"workerCount"`
}
// NewWorkerPool registers a new resource with the given unique name, arguments, and options.
func NewWorkerPool(ctx *pulumi.Context,
name string, args *WorkerPoolArgs, opts ...pulumi.ResourceOption) (*WorkerPool, error) {
if args == nil {
args = &WorkerPoolArgs{}
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"project",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource WorkerPool
err := ctx.RegisterResource("google-native:cloudbuild/v1alpha1:WorkerPool", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetWorkerPool gets an existing WorkerPool 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 GetWorkerPool(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *WorkerPoolState, opts ...pulumi.ResourceOption) (*WorkerPool, error) {
var resource WorkerPool
err := ctx.ReadResource("google-native:cloudbuild/v1alpha1:WorkerPool", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering WorkerPool resources.
type workerPoolState struct {
}
type WorkerPoolState struct {
}
func (WorkerPoolState) ElementType() reflect.Type {
return reflect.TypeOf((*workerPoolState)(nil)).Elem()
}
type workerPoolArgs struct {
// User-defined name of the `WorkerPool`.
Name *string `pulumi:"name"`
// The project ID of the GCP project for which the `WorkerPool` is created.
Project *string `pulumi:"project"`
// List of regions to create the `WorkerPool`. Regions can't be empty. If Cloud Build adds a new GCP region in the future, the existing `WorkerPool` will not be enabled in the new region automatically; you must add the new region to the `regions` field to enable the `WorkerPool` in that region.
Regions []WorkerPoolRegionsItem `pulumi:"regions"`
// Configuration to be used for a creating workers in the `WorkerPool`.
WorkerConfig *WorkerConfig `pulumi:"workerConfig"`
// Total number of workers to be created across all requested regions.
WorkerCount *string `pulumi:"workerCount"`
}
// The set of arguments for constructing a WorkerPool resource.
type WorkerPoolArgs struct {
// User-defined name of the `WorkerPool`.
Name pulumi.StringPtrInput
// The project ID of the GCP project for which the `WorkerPool` is created.
Project pulumi.StringPtrInput
// List of regions to create the `WorkerPool`. Regions can't be empty. If Cloud Build adds a new GCP region in the future, the existing `WorkerPool` will not be enabled in the new region automatically; you must add the new region to the `regions` field to enable the `WorkerPool` in that region.
Regions WorkerPoolRegionsItemArrayInput
// Configuration to be used for a creating workers in the `WorkerPool`.
WorkerConfig WorkerConfigPtrInput
// Total number of workers to be created across all requested regions.
WorkerCount pulumi.StringPtrInput
}
func (WorkerPoolArgs) ElementType() reflect.Type {
return reflect.TypeOf((*workerPoolArgs)(nil)).Elem()
}
type WorkerPoolInput interface {
pulumi.Input
ToWorkerPoolOutput() WorkerPoolOutput
ToWorkerPoolOutputWithContext(ctx context.Context) WorkerPoolOutput
}
func (*WorkerPool) ElementType() reflect.Type {
return reflect.TypeOf((**WorkerPool)(nil)).Elem()
}
func (i *WorkerPool) ToWorkerPoolOutput() WorkerPoolOutput {
return i.ToWorkerPoolOutputWithContext(context.Background())
}
func (i *WorkerPool) ToWorkerPoolOutputWithContext(ctx context.Context) WorkerPoolOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkerPoolOutput)
}
type WorkerPoolOutput struct{ *pulumi.OutputState }
func (WorkerPoolOutput) ElementType() reflect.Type {
return reflect.TypeOf((**WorkerPool)(nil)).Elem()
}
func (o WorkerPoolOutput) ToWorkerPoolOutput() WorkerPoolOutput {
return o
}
func (o WorkerPoolOutput) ToWorkerPoolOutputWithContext(ctx context.Context) WorkerPoolOutput {
return o
}
// Time at which the request to create the `WorkerPool` was received.
func (o WorkerPoolOutput) CreateTime() pulumi.StringOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)
}
// Time at which the request to delete the `WorkerPool` was received.
func (o WorkerPoolOutput) DeleteTime() pulumi.StringOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.DeleteTime }).(pulumi.StringOutput)
}
// User-defined name of the `WorkerPool`.
func (o WorkerPoolOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o WorkerPoolOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// List of regions to create the `WorkerPool`. Regions can't be empty. If Cloud Build adds a new GCP region in the future, the existing `WorkerPool` will not be enabled in the new region automatically; you must add the new region to the `regions` field to enable the `WorkerPool` in that region.
func (o WorkerPoolOutput) Regions() pulumi.StringArrayOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringArrayOutput { return v.Regions }).(pulumi.StringArrayOutput)
}
// The service account used to manage the `WorkerPool`. The service account must have the Compute Instance Admin (Beta) permission at the project level.
func (o WorkerPoolOutput) ServiceAccountEmail() pulumi.StringOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.ServiceAccountEmail }).(pulumi.StringOutput)
}
// WorkerPool Status.
func (o WorkerPoolOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// Time at which the request to update the `WorkerPool` was received.
func (o WorkerPoolOutput) UpdateTime() pulumi.StringOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.UpdateTime }).(pulumi.StringOutput)
}
// Configuration to be used for a creating workers in the `WorkerPool`.
func (o WorkerPoolOutput) WorkerConfig() WorkerConfigResponseOutput {
return o.ApplyT(func(v *WorkerPool) WorkerConfigResponseOutput { return v.WorkerConfig }).(WorkerConfigResponseOutput)
}
// Total number of workers to be created across all requested regions.
func (o WorkerPoolOutput) WorkerCount() pulumi.StringOutput {
return o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.WorkerCount }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*WorkerPoolInput)(nil)).Elem(), &WorkerPool{})
pulumi.RegisterOutputType(WorkerPoolOutput{})
}