/
service.go
309 lines (267 loc) · 14.8 KB
/
service.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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// 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 v3
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Create a Service.
// Auto-naming is currently not supported for this resource.
type Service struct {
pulumi.CustomResourceState
// Type used for App Engine services.
AppEngine AppEngineResponseOutput `pulumi:"appEngine"`
// Message that contains the service type and service labels of this service if it is a basic service. Documentation and examples here (https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
BasicService BasicServiceResponseOutput `pulumi:"basicService"`
// Type used for Cloud Endpoints services.
CloudEndpoints CloudEndpointsResponseOutput `pulumi:"cloudEndpoints"`
// Type used for Cloud Run services.
CloudRun CloudRunResponseOutput `pulumi:"cloudRun"`
// Type used for Istio services that live in a Kubernetes cluster.
ClusterIstio ClusterIstioResponseOutput `pulumi:"clusterIstio"`
// Custom service type.
Custom CustomResponseOutput `pulumi:"custom"`
// Name used for UI elements listing this Service.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// Type used for GKE Namespaces.
GkeNamespace GkeNamespaceResponseOutput `pulumi:"gkeNamespace"`
// Type used for GKE Services (the Kubernetes concept of a service).
GkeService GkeServiceResponseOutput `pulumi:"gkeService"`
// Type used for GKE Workloads.
GkeWorkload GkeWorkloadResponseOutput `pulumi:"gkeWorkload"`
// Type used for canonical services scoped to an Istio mesh. Metrics for Istio are documented here (https://istio.io/latest/docs/reference/config/metrics/)
IstioCanonicalService IstioCanonicalServiceResponseOutput `pulumi:"istioCanonicalService"`
// Type used for Istio services scoped to an Istio mesh.
MeshIstio MeshIstioResponseOutput `pulumi:"meshIstio"`
// Resource name for this Service. The format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
Name pulumi.StringOutput `pulumi:"name"`
// Optional. The Service id to use for this Service. If omitted, an id will be generated instead. Must match the pattern [a-z0-9\-]+
ServiceId pulumi.StringPtrOutput `pulumi:"serviceId"`
// Configuration for how to query telemetry on a Service.
Telemetry TelemetryResponseOutput `pulumi:"telemetry"`
// Labels which have been used to annotate the service. Label keys must start with a letter. Label keys and values may contain lowercase letters, numbers, underscores, and dashes. Label keys and values have a maximum length of 63 characters, and must be less than 128 bytes in size. Up to 64 label entries may be stored. For labels which do not have a semantic value, the empty string may be supplied for the label value.
UserLabels pulumi.StringMapOutput `pulumi:"userLabels"`
V3Id pulumi.StringOutput `pulumi:"v3Id"`
V3Id1 pulumi.StringOutput `pulumi:"v3Id1"`
}
// NewService registers a new resource with the given unique name, arguments, and options.
func NewService(ctx *pulumi.Context,
name string, args *ServiceArgs, opts ...pulumi.ResourceOption) (*Service, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.V3Id == nil {
return nil, errors.New("invalid value for required argument 'V3Id'")
}
if args.V3Id1 == nil {
return nil, errors.New("invalid value for required argument 'V3Id1'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"v3Id",
"v3Id1",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Service
err := ctx.RegisterResource("google-native:monitoring/v3:Service", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetService gets an existing Service 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 GetService(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ServiceState, opts ...pulumi.ResourceOption) (*Service, error) {
var resource Service
err := ctx.ReadResource("google-native:monitoring/v3:Service", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Service resources.
type serviceState struct {
}
type ServiceState struct {
}
func (ServiceState) ElementType() reflect.Type {
return reflect.TypeOf((*serviceState)(nil)).Elem()
}
type serviceArgs struct {
// Type used for App Engine services.
AppEngine *AppEngine `pulumi:"appEngine"`
// Message that contains the service type and service labels of this service if it is a basic service. Documentation and examples here (https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
BasicService *BasicService `pulumi:"basicService"`
// Type used for Cloud Endpoints services.
CloudEndpoints *CloudEndpoints `pulumi:"cloudEndpoints"`
// Type used for Cloud Run services.
CloudRun *CloudRun `pulumi:"cloudRun"`
// Type used for Istio services that live in a Kubernetes cluster.
ClusterIstio *ClusterIstio `pulumi:"clusterIstio"`
// Custom service type.
Custom *Custom `pulumi:"custom"`
// Name used for UI elements listing this Service.
DisplayName *string `pulumi:"displayName"`
// Type used for GKE Namespaces.
GkeNamespace *GkeNamespace `pulumi:"gkeNamespace"`
// Type used for GKE Services (the Kubernetes concept of a service).
GkeService *GkeService `pulumi:"gkeService"`
// Type used for GKE Workloads.
GkeWorkload *GkeWorkload `pulumi:"gkeWorkload"`
// Type used for canonical services scoped to an Istio mesh. Metrics for Istio are documented here (https://istio.io/latest/docs/reference/config/metrics/)
IstioCanonicalService *IstioCanonicalService `pulumi:"istioCanonicalService"`
// Type used for Istio services scoped to an Istio mesh.
MeshIstio *MeshIstio `pulumi:"meshIstio"`
// Resource name for this Service. The format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
Name *string `pulumi:"name"`
// Optional. The Service id to use for this Service. If omitted, an id will be generated instead. Must match the pattern [a-z0-9\-]+
ServiceId *string `pulumi:"serviceId"`
// Configuration for how to query telemetry on a Service.
Telemetry *Telemetry `pulumi:"telemetry"`
// Labels which have been used to annotate the service. Label keys must start with a letter. Label keys and values may contain lowercase letters, numbers, underscores, and dashes. Label keys and values have a maximum length of 63 characters, and must be less than 128 bytes in size. Up to 64 label entries may be stored. For labels which do not have a semantic value, the empty string may be supplied for the label value.
UserLabels map[string]string `pulumi:"userLabels"`
V3Id string `pulumi:"v3Id"`
V3Id1 string `pulumi:"v3Id1"`
}
// The set of arguments for constructing a Service resource.
type ServiceArgs struct {
// Type used for App Engine services.
AppEngine AppEnginePtrInput
// Message that contains the service type and service labels of this service if it is a basic service. Documentation and examples here (https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
BasicService BasicServicePtrInput
// Type used for Cloud Endpoints services.
CloudEndpoints CloudEndpointsPtrInput
// Type used for Cloud Run services.
CloudRun CloudRunPtrInput
// Type used for Istio services that live in a Kubernetes cluster.
ClusterIstio ClusterIstioPtrInput
// Custom service type.
Custom CustomPtrInput
// Name used for UI elements listing this Service.
DisplayName pulumi.StringPtrInput
// Type used for GKE Namespaces.
GkeNamespace GkeNamespacePtrInput
// Type used for GKE Services (the Kubernetes concept of a service).
GkeService GkeServicePtrInput
// Type used for GKE Workloads.
GkeWorkload GkeWorkloadPtrInput
// Type used for canonical services scoped to an Istio mesh. Metrics for Istio are documented here (https://istio.io/latest/docs/reference/config/metrics/)
IstioCanonicalService IstioCanonicalServicePtrInput
// Type used for Istio services scoped to an Istio mesh.
MeshIstio MeshIstioPtrInput
// Resource name for this Service. The format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
Name pulumi.StringPtrInput
// Optional. The Service id to use for this Service. If omitted, an id will be generated instead. Must match the pattern [a-z0-9\-]+
ServiceId pulumi.StringPtrInput
// Configuration for how to query telemetry on a Service.
Telemetry TelemetryPtrInput
// Labels which have been used to annotate the service. Label keys must start with a letter. Label keys and values may contain lowercase letters, numbers, underscores, and dashes. Label keys and values have a maximum length of 63 characters, and must be less than 128 bytes in size. Up to 64 label entries may be stored. For labels which do not have a semantic value, the empty string may be supplied for the label value.
UserLabels pulumi.StringMapInput
V3Id pulumi.StringInput
V3Id1 pulumi.StringInput
}
func (ServiceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*serviceArgs)(nil)).Elem()
}
type ServiceInput interface {
pulumi.Input
ToServiceOutput() ServiceOutput
ToServiceOutputWithContext(ctx context.Context) ServiceOutput
}
func (*Service) ElementType() reflect.Type {
return reflect.TypeOf((**Service)(nil)).Elem()
}
func (i *Service) ToServiceOutput() ServiceOutput {
return i.ToServiceOutputWithContext(context.Background())
}
func (i *Service) ToServiceOutputWithContext(ctx context.Context) ServiceOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServiceOutput)
}
type ServiceOutput struct{ *pulumi.OutputState }
func (ServiceOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Service)(nil)).Elem()
}
func (o ServiceOutput) ToServiceOutput() ServiceOutput {
return o
}
func (o ServiceOutput) ToServiceOutputWithContext(ctx context.Context) ServiceOutput {
return o
}
// Type used for App Engine services.
func (o ServiceOutput) AppEngine() AppEngineResponseOutput {
return o.ApplyT(func(v *Service) AppEngineResponseOutput { return v.AppEngine }).(AppEngineResponseOutput)
}
// Message that contains the service type and service labels of this service if it is a basic service. Documentation and examples here (https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
func (o ServiceOutput) BasicService() BasicServiceResponseOutput {
return o.ApplyT(func(v *Service) BasicServiceResponseOutput { return v.BasicService }).(BasicServiceResponseOutput)
}
// Type used for Cloud Endpoints services.
func (o ServiceOutput) CloudEndpoints() CloudEndpointsResponseOutput {
return o.ApplyT(func(v *Service) CloudEndpointsResponseOutput { return v.CloudEndpoints }).(CloudEndpointsResponseOutput)
}
// Type used for Cloud Run services.
func (o ServiceOutput) CloudRun() CloudRunResponseOutput {
return o.ApplyT(func(v *Service) CloudRunResponseOutput { return v.CloudRun }).(CloudRunResponseOutput)
}
// Type used for Istio services that live in a Kubernetes cluster.
func (o ServiceOutput) ClusterIstio() ClusterIstioResponseOutput {
return o.ApplyT(func(v *Service) ClusterIstioResponseOutput { return v.ClusterIstio }).(ClusterIstioResponseOutput)
}
// Custom service type.
func (o ServiceOutput) Custom() CustomResponseOutput {
return o.ApplyT(func(v *Service) CustomResponseOutput { return v.Custom }).(CustomResponseOutput)
}
// Name used for UI elements listing this Service.
func (o ServiceOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v *Service) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
}
// Type used for GKE Namespaces.
func (o ServiceOutput) GkeNamespace() GkeNamespaceResponseOutput {
return o.ApplyT(func(v *Service) GkeNamespaceResponseOutput { return v.GkeNamespace }).(GkeNamespaceResponseOutput)
}
// Type used for GKE Services (the Kubernetes concept of a service).
func (o ServiceOutput) GkeService() GkeServiceResponseOutput {
return o.ApplyT(func(v *Service) GkeServiceResponseOutput { return v.GkeService }).(GkeServiceResponseOutput)
}
// Type used for GKE Workloads.
func (o ServiceOutput) GkeWorkload() GkeWorkloadResponseOutput {
return o.ApplyT(func(v *Service) GkeWorkloadResponseOutput { return v.GkeWorkload }).(GkeWorkloadResponseOutput)
}
// Type used for canonical services scoped to an Istio mesh. Metrics for Istio are documented here (https://istio.io/latest/docs/reference/config/metrics/)
func (o ServiceOutput) IstioCanonicalService() IstioCanonicalServiceResponseOutput {
return o.ApplyT(func(v *Service) IstioCanonicalServiceResponseOutput { return v.IstioCanonicalService }).(IstioCanonicalServiceResponseOutput)
}
// Type used for Istio services scoped to an Istio mesh.
func (o ServiceOutput) MeshIstio() MeshIstioResponseOutput {
return o.ApplyT(func(v *Service) MeshIstioResponseOutput { return v.MeshIstio }).(MeshIstioResponseOutput)
}
// Resource name for this Service. The format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
func (o ServiceOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Service) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Optional. The Service id to use for this Service. If omitted, an id will be generated instead. Must match the pattern [a-z0-9\-]+
func (o ServiceOutput) ServiceId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Service) pulumi.StringPtrOutput { return v.ServiceId }).(pulumi.StringPtrOutput)
}
// Configuration for how to query telemetry on a Service.
func (o ServiceOutput) Telemetry() TelemetryResponseOutput {
return o.ApplyT(func(v *Service) TelemetryResponseOutput { return v.Telemetry }).(TelemetryResponseOutput)
}
// Labels which have been used to annotate the service. Label keys must start with a letter. Label keys and values may contain lowercase letters, numbers, underscores, and dashes. Label keys and values have a maximum length of 63 characters, and must be less than 128 bytes in size. Up to 64 label entries may be stored. For labels which do not have a semantic value, the empty string may be supplied for the label value.
func (o ServiceOutput) UserLabels() pulumi.StringMapOutput {
return o.ApplyT(func(v *Service) pulumi.StringMapOutput { return v.UserLabels }).(pulumi.StringMapOutput)
}
func (o ServiceOutput) V3Id() pulumi.StringOutput {
return o.ApplyT(func(v *Service) pulumi.StringOutput { return v.V3Id }).(pulumi.StringOutput)
}
func (o ServiceOutput) V3Id1() pulumi.StringOutput {
return o.ApplyT(func(v *Service) pulumi.StringOutput { return v.V3Id1 }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ServiceInput)(nil)).Elem(), &Service{})
pulumi.RegisterOutputType(ServiceOutput{})
}