/
getAutoscaler.go
164 lines (137 loc) · 9.67 KB
/
getAutoscaler.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
// 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 beta
import (
"context"
"reflect"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Returns the specified autoscaler resource.
func LookupAutoscaler(ctx *pulumi.Context, args *LookupAutoscalerArgs, opts ...pulumi.InvokeOption) (*LookupAutoscalerResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupAutoscalerResult
err := ctx.Invoke("google-native:compute/beta:getAutoscaler", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type LookupAutoscalerArgs struct {
Autoscaler string `pulumi:"autoscaler"`
Project *string `pulumi:"project"`
Zone string `pulumi:"zone"`
}
type LookupAutoscalerResult struct {
// The configuration parameters for the autoscaling algorithm. You can define one or more signals for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%.
AutoscalingPolicy AutoscalingPolicyResponse `pulumi:"autoscalingPolicy"`
// Creation timestamp in RFC3339 text format.
CreationTimestamp string `pulumi:"creationTimestamp"`
// An optional description of this resource. Provide this property when you create the resource.
Description string `pulumi:"description"`
// Type of the resource. Always compute#autoscaler for autoscalers.
Kind string `pulumi:"kind"`
// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
Name string `pulumi:"name"`
// Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates the recommended MIG size even when the autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to an existing managed instance group or autoscaler did not generate its prediction.
RecommendedSize int `pulumi:"recommendedSize"`
// URL of the region where the instance group resides (for autoscalers living in regional scope).
Region string `pulumi:"region"`
// Status information of existing scaling schedules.
ScalingScheduleStatus map[string]string `pulumi:"scalingScheduleStatus"`
// Server-defined URL for the resource.
SelfLink string `pulumi:"selfLink"`
// The status of the autoscaler configuration. Current set of possible values: - PENDING: Autoscaler backend hasn't read new/updated configuration. - DELETING: Configuration is being deleted. - ACTIVE: Configuration is acknowledged to be effective. Some warnings might be present in the statusDetails field. - ERROR: Configuration has errors. Actionable for users. Details are present in the statusDetails field. New values might be added in the future.
Status string `pulumi:"status"`
// Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter.
StatusDetails []AutoscalerStatusDetailsResponse `pulumi:"statusDetails"`
// URL of the managed instance group that this autoscaler will scale. This field is required when creating an autoscaler.
Target string `pulumi:"target"`
// URL of the zone where the instance group resides (for autoscalers living in zonal scope).
Zone string `pulumi:"zone"`
}
func LookupAutoscalerOutput(ctx *pulumi.Context, args LookupAutoscalerOutputArgs, opts ...pulumi.InvokeOption) LookupAutoscalerResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupAutoscalerResult, error) {
args := v.(LookupAutoscalerArgs)
r, err := LookupAutoscaler(ctx, &args, opts...)
var s LookupAutoscalerResult
if r != nil {
s = *r
}
return s, err
}).(LookupAutoscalerResultOutput)
}
type LookupAutoscalerOutputArgs struct {
Autoscaler pulumi.StringInput `pulumi:"autoscaler"`
Project pulumi.StringPtrInput `pulumi:"project"`
Zone pulumi.StringInput `pulumi:"zone"`
}
func (LookupAutoscalerOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupAutoscalerArgs)(nil)).Elem()
}
type LookupAutoscalerResultOutput struct{ *pulumi.OutputState }
func (LookupAutoscalerResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupAutoscalerResult)(nil)).Elem()
}
func (o LookupAutoscalerResultOutput) ToLookupAutoscalerResultOutput() LookupAutoscalerResultOutput {
return o
}
func (o LookupAutoscalerResultOutput) ToLookupAutoscalerResultOutputWithContext(ctx context.Context) LookupAutoscalerResultOutput {
return o
}
// The configuration parameters for the autoscaling algorithm. You can define one or more signals for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%.
func (o LookupAutoscalerResultOutput) AutoscalingPolicy() AutoscalingPolicyResponseOutput {
return o.ApplyT(func(v LookupAutoscalerResult) AutoscalingPolicyResponse { return v.AutoscalingPolicy }).(AutoscalingPolicyResponseOutput)
}
// Creation timestamp in RFC3339 text format.
func (o LookupAutoscalerResultOutput) CreationTimestamp() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.CreationTimestamp }).(pulumi.StringOutput)
}
// An optional description of this resource. Provide this property when you create the resource.
func (o LookupAutoscalerResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.Description }).(pulumi.StringOutput)
}
// Type of the resource. Always compute#autoscaler for autoscalers.
func (o LookupAutoscalerResultOutput) Kind() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.Kind }).(pulumi.StringOutput)
}
// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
func (o LookupAutoscalerResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.Name }).(pulumi.StringOutput)
}
// Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates the recommended MIG size even when the autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to an existing managed instance group or autoscaler did not generate its prediction.
func (o LookupAutoscalerResultOutput) RecommendedSize() pulumi.IntOutput {
return o.ApplyT(func(v LookupAutoscalerResult) int { return v.RecommendedSize }).(pulumi.IntOutput)
}
// URL of the region where the instance group resides (for autoscalers living in regional scope).
func (o LookupAutoscalerResultOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.Region }).(pulumi.StringOutput)
}
// Status information of existing scaling schedules.
func (o LookupAutoscalerResultOutput) ScalingScheduleStatus() pulumi.StringMapOutput {
return o.ApplyT(func(v LookupAutoscalerResult) map[string]string { return v.ScalingScheduleStatus }).(pulumi.StringMapOutput)
}
// Server-defined URL for the resource.
func (o LookupAutoscalerResultOutput) SelfLink() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.SelfLink }).(pulumi.StringOutput)
}
// The status of the autoscaler configuration. Current set of possible values: - PENDING: Autoscaler backend hasn't read new/updated configuration. - DELETING: Configuration is being deleted. - ACTIVE: Configuration is acknowledged to be effective. Some warnings might be present in the statusDetails field. - ERROR: Configuration has errors. Actionable for users. Details are present in the statusDetails field. New values might be added in the future.
func (o LookupAutoscalerResultOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.Status }).(pulumi.StringOutput)
}
// Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter.
func (o LookupAutoscalerResultOutput) StatusDetails() AutoscalerStatusDetailsResponseArrayOutput {
return o.ApplyT(func(v LookupAutoscalerResult) []AutoscalerStatusDetailsResponse { return v.StatusDetails }).(AutoscalerStatusDetailsResponseArrayOutput)
}
// URL of the managed instance group that this autoscaler will scale. This field is required when creating an autoscaler.
func (o LookupAutoscalerResultOutput) Target() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.Target }).(pulumi.StringOutput)
}
// URL of the zone where the instance group resides (for autoscalers living in zonal scope).
func (o LookupAutoscalerResultOutput) Zone() pulumi.StringOutput {
return o.ApplyT(func(v LookupAutoscalerResult) string { return v.Zone }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupAutoscalerResultOutput{})
}