/
getModel.go
127 lines (105 loc) · 8.87 KB
/
getModel.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
// 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 v1
import (
"context"
"reflect"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Gets information about a model, including its name, the description (if set), and the default version (if at least one version of the model has been deployed).
func LookupModel(ctx *pulumi.Context, args *LookupModelArgs, opts ...pulumi.InvokeOption) (*LookupModelResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupModelResult
err := ctx.Invoke("google-native:ml/v1:getModel", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type LookupModelArgs struct {
ModelId string `pulumi:"modelId"`
Project *string `pulumi:"project"`
}
type LookupModelResult struct {
// The default version of the model. This version will be used to handle prediction requests that do not specify a version. You can change the default version by calling projects.models.versions.setDefault.
DefaultVersion GoogleCloudMlV1__VersionResponse `pulumi:"defaultVersion"`
// Optional. The description specified for the model when it was created.
Description string `pulumi:"description"`
// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a model from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform model updates in order to avoid race conditions: An `etag` is returned in the response to `GetModel`, and systems are expected to put that etag in the request to `UpdateModel` to ensure that their change will be applied to the model as intended.
Etag string `pulumi:"etag"`
// Optional. One or more labels that you can add, to organize your models. Each label is a key-value pair, where both the key and the value are arbitrary strings that you supply. For more information, see the documentation on using labels. Note that this field is not updatable for mls1* models.
Labels map[string]string `pulumi:"labels"`
// The name specified for the model when it was created. The model name must be unique within the project it is created in.
Name string `pulumi:"name"`
// Optional. If true, online prediction nodes send `stderr` and `stdout` streams to Cloud Logging. These can be more verbose than the standard access logs (see `onlinePredictionLogging`) and can incur higher cost. However, they are helpful for debugging. Note that [logs may incur a cost](/stackdriver/pricing), especially if your project receives prediction requests at a high QPS. Estimate your costs before enabling this option. Default is false.
OnlinePredictionConsoleLogging bool `pulumi:"onlinePredictionConsoleLogging"`
// Optional. If true, online prediction access logs are sent to Cloud Logging. These logs are like standard server access logs, containing information like timestamp and latency for each request. Note that [logs may incur a cost](/stackdriver/pricing), especially if your project receives prediction requests at a high queries per second rate (QPS). Estimate your costs before enabling this option. Default is false.
OnlinePredictionLogging bool `pulumi:"onlinePredictionLogging"`
// Optional. The list of regions where the model is going to be deployed. Only one region per model is supported. Defaults to 'us-central1' if nothing is set. See the available regions for AI Platform services. Note: * No matter where a model is deployed, it can always be accessed by users from anywhere, both for online and batch prediction. * The region for a batch prediction job is set by the region field when submitting the batch prediction job and does not take its value from this field.
Regions []string `pulumi:"regions"`
}
func LookupModelOutput(ctx *pulumi.Context, args LookupModelOutputArgs, opts ...pulumi.InvokeOption) LookupModelResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupModelResult, error) {
args := v.(LookupModelArgs)
r, err := LookupModel(ctx, &args, opts...)
var s LookupModelResult
if r != nil {
s = *r
}
return s, err
}).(LookupModelResultOutput)
}
type LookupModelOutputArgs struct {
ModelId pulumi.StringInput `pulumi:"modelId"`
Project pulumi.StringPtrInput `pulumi:"project"`
}
func (LookupModelOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupModelArgs)(nil)).Elem()
}
type LookupModelResultOutput struct{ *pulumi.OutputState }
func (LookupModelResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupModelResult)(nil)).Elem()
}
func (o LookupModelResultOutput) ToLookupModelResultOutput() LookupModelResultOutput {
return o
}
func (o LookupModelResultOutput) ToLookupModelResultOutputWithContext(ctx context.Context) LookupModelResultOutput {
return o
}
// The default version of the model. This version will be used to handle prediction requests that do not specify a version. You can change the default version by calling projects.models.versions.setDefault.
func (o LookupModelResultOutput) DefaultVersion() GoogleCloudMlV1__VersionResponseOutput {
return o.ApplyT(func(v LookupModelResult) GoogleCloudMlV1__VersionResponse { return v.DefaultVersion }).(GoogleCloudMlV1__VersionResponseOutput)
}
// Optional. The description specified for the model when it was created.
func (o LookupModelResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupModelResult) string { return v.Description }).(pulumi.StringOutput)
}
// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a model from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform model updates in order to avoid race conditions: An `etag` is returned in the response to `GetModel`, and systems are expected to put that etag in the request to `UpdateModel` to ensure that their change will be applied to the model as intended.
func (o LookupModelResultOutput) Etag() pulumi.StringOutput {
return o.ApplyT(func(v LookupModelResult) string { return v.Etag }).(pulumi.StringOutput)
}
// Optional. One or more labels that you can add, to organize your models. Each label is a key-value pair, where both the key and the value are arbitrary strings that you supply. For more information, see the documentation on using labels. Note that this field is not updatable for mls1* models.
func (o LookupModelResultOutput) Labels() pulumi.StringMapOutput {
return o.ApplyT(func(v LookupModelResult) map[string]string { return v.Labels }).(pulumi.StringMapOutput)
}
// The name specified for the model when it was created. The model name must be unique within the project it is created in.
func (o LookupModelResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupModelResult) string { return v.Name }).(pulumi.StringOutput)
}
// Optional. If true, online prediction nodes send `stderr` and `stdout` streams to Cloud Logging. These can be more verbose than the standard access logs (see `onlinePredictionLogging`) and can incur higher cost. However, they are helpful for debugging. Note that [logs may incur a cost](/stackdriver/pricing), especially if your project receives prediction requests at a high QPS. Estimate your costs before enabling this option. Default is false.
func (o LookupModelResultOutput) OnlinePredictionConsoleLogging() pulumi.BoolOutput {
return o.ApplyT(func(v LookupModelResult) bool { return v.OnlinePredictionConsoleLogging }).(pulumi.BoolOutput)
}
// Optional. If true, online prediction access logs are sent to Cloud Logging. These logs are like standard server access logs, containing information like timestamp and latency for each request. Note that [logs may incur a cost](/stackdriver/pricing), especially if your project receives prediction requests at a high queries per second rate (QPS). Estimate your costs before enabling this option. Default is false.
func (o LookupModelResultOutput) OnlinePredictionLogging() pulumi.BoolOutput {
return o.ApplyT(func(v LookupModelResult) bool { return v.OnlinePredictionLogging }).(pulumi.BoolOutput)
}
// Optional. The list of regions where the model is going to be deployed. Only one region per model is supported. Defaults to 'us-central1' if nothing is set. See the available regions for AI Platform services. Note: * No matter where a model is deployed, it can always be accessed by users from anywhere, both for online and batch prediction. * The region for a batch prediction job is set by the region field when submitting the batch prediction job and does not take its value from this field.
func (o LookupModelResultOutput) Regions() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupModelResult) []string { return v.Regions }).(pulumi.StringArrayOutput)
}
func init() {
pulumi.RegisterOutputType(LookupModelResultOutput{})
}