/
instance.go
171 lines (141 loc) · 6.93 KB
/
instance.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
// 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 v1alpha
import (
"context"
"reflect"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a new instance in the specified region. Returns a long running operation which contains an instance on completion. While the long running operation is in progress, any call to `GetInstance` returns an instance in state `CREATING`.
// Auto-naming is currently not supported for this resource.
type Instance struct {
pulumi.CustomResourceState
// The policy to define whether or not RBE features can be used or how they can be used.
FeaturePolicy GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyResponseOutput `pulumi:"featurePolicy"`
// The location is a GCP region. Currently only `us-central1` is supported.
Location pulumi.StringOutput `pulumi:"location"`
// Whether stack driver logging is enabled for the instance.
LoggingEnabled pulumi.BoolOutput `pulumi:"loggingEnabled"`
// Instance resource name formatted as: `projects/[PROJECT_ID]/instances/[INSTANCE_ID]`. Name should not be populated when creating an instance since it is provided in the `instance_id` field.
Name pulumi.StringOutput `pulumi:"name"`
Project pulumi.StringOutput `pulumi:"project"`
// State of the instance.
State pulumi.StringOutput `pulumi:"state"`
}
// NewInstance registers a new resource with the given unique name, arguments, and options.
func NewInstance(ctx *pulumi.Context,
name string, args *InstanceArgs, opts ...pulumi.ResourceOption) (*Instance, error) {
if args == nil {
args = &InstanceArgs{}
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"project",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Instance
err := ctx.RegisterResource("google-native:remotebuildexecution/v1alpha:Instance", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetInstance gets an existing Instance 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 GetInstance(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *InstanceState, opts ...pulumi.ResourceOption) (*Instance, error) {
var resource Instance
err := ctx.ReadResource("google-native:remotebuildexecution/v1alpha:Instance", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Instance resources.
type instanceState struct {
}
type InstanceState struct {
}
func (InstanceState) ElementType() reflect.Type {
return reflect.TypeOf((*instanceState)(nil)).Elem()
}
type instanceArgs struct {
// The policy to define whether or not RBE features can be used or how they can be used.
FeaturePolicy *GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicy `pulumi:"featurePolicy"`
// ID of the created instance. A valid `instance_id` must: be 6-50 characters long, contain only lowercase letters, digits, hyphens and underscores, start with a lowercase letter, and end with a lowercase letter or a digit.
InstanceId *string `pulumi:"instanceId"`
// The location is a GCP region. Currently only `us-central1` is supported.
Location *string `pulumi:"location"`
// Resource name of the project containing the instance. Format: `projects/[PROJECT_ID]`.
Parent *string `pulumi:"parent"`
Project *string `pulumi:"project"`
}
// The set of arguments for constructing a Instance resource.
type InstanceArgs struct {
// The policy to define whether or not RBE features can be used or how they can be used.
FeaturePolicy GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyPtrInput
// ID of the created instance. A valid `instance_id` must: be 6-50 characters long, contain only lowercase letters, digits, hyphens and underscores, start with a lowercase letter, and end with a lowercase letter or a digit.
InstanceId pulumi.StringPtrInput
// The location is a GCP region. Currently only `us-central1` is supported.
Location pulumi.StringPtrInput
// Resource name of the project containing the instance. Format: `projects/[PROJECT_ID]`.
Parent pulumi.StringPtrInput
Project pulumi.StringPtrInput
}
func (InstanceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*instanceArgs)(nil)).Elem()
}
type InstanceInput interface {
pulumi.Input
ToInstanceOutput() InstanceOutput
ToInstanceOutputWithContext(ctx context.Context) InstanceOutput
}
func (*Instance) ElementType() reflect.Type {
return reflect.TypeOf((**Instance)(nil)).Elem()
}
func (i *Instance) ToInstanceOutput() InstanceOutput {
return i.ToInstanceOutputWithContext(context.Background())
}
func (i *Instance) ToInstanceOutputWithContext(ctx context.Context) InstanceOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceOutput)
}
type InstanceOutput struct{ *pulumi.OutputState }
func (InstanceOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Instance)(nil)).Elem()
}
func (o InstanceOutput) ToInstanceOutput() InstanceOutput {
return o
}
func (o InstanceOutput) ToInstanceOutputWithContext(ctx context.Context) InstanceOutput {
return o
}
// The policy to define whether or not RBE features can be used or how they can be used.
func (o InstanceOutput) FeaturePolicy() GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyResponseOutput {
return o.ApplyT(func(v *Instance) GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyResponseOutput {
return v.FeaturePolicy
}).(GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyResponseOutput)
}
// The location is a GCP region. Currently only `us-central1` is supported.
func (o InstanceOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// Whether stack driver logging is enabled for the instance.
func (o InstanceOutput) LoggingEnabled() pulumi.BoolOutput {
return o.ApplyT(func(v *Instance) pulumi.BoolOutput { return v.LoggingEnabled }).(pulumi.BoolOutput)
}
// Instance resource name formatted as: `projects/[PROJECT_ID]/instances/[INSTANCE_ID]`. Name should not be populated when creating an instance since it is provided in the `instance_id` field.
func (o InstanceOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o InstanceOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// State of the instance.
func (o InstanceOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*InstanceInput)(nil)).Elem(), &Instance{})
pulumi.RegisterOutputType(InstanceOutput{})
}