1// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
16
17package aiplatform_test
18
19import (
20	"context"
21
22	aiplatform "cloud.google.com/go/aiplatform/apiv1"
23	"google.golang.org/api/iterator"
24	aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1"
25)
26
27func ExampleNewVizierClient() {
28	ctx := context.Background()
29	c, err := aiplatform.NewVizierClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	defer c.Close()
34
35	// TODO: Use client.
36	_ = c
37}
38
39func ExampleVizierClient_CreateStudy() {
40	ctx := context.Background()
41	c, err := aiplatform.NewVizierClient(ctx)
42	if err != nil {
43		// TODO: Handle error.
44	}
45	defer c.Close()
46
47	req := &aiplatformpb.CreateStudyRequest{
48		// TODO: Fill request struct fields.
49		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateStudyRequest.
50	}
51	resp, err := c.CreateStudy(ctx, req)
52	if err != nil {
53		// TODO: Handle error.
54	}
55	// TODO: Use resp.
56	_ = resp
57}
58
59func ExampleVizierClient_GetStudy() {
60	ctx := context.Background()
61	c, err := aiplatform.NewVizierClient(ctx)
62	if err != nil {
63		// TODO: Handle error.
64	}
65	defer c.Close()
66
67	req := &aiplatformpb.GetStudyRequest{
68		// TODO: Fill request struct fields.
69		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetStudyRequest.
70	}
71	resp, err := c.GetStudy(ctx, req)
72	if err != nil {
73		// TODO: Handle error.
74	}
75	// TODO: Use resp.
76	_ = resp
77}
78
79func ExampleVizierClient_ListStudies() {
80	ctx := context.Background()
81	c, err := aiplatform.NewVizierClient(ctx)
82	if err != nil {
83		// TODO: Handle error.
84	}
85	defer c.Close()
86
87	req := &aiplatformpb.ListStudiesRequest{
88		// TODO: Fill request struct fields.
89		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListStudiesRequest.
90	}
91	it := c.ListStudies(ctx, req)
92	for {
93		resp, err := it.Next()
94		if err == iterator.Done {
95			break
96		}
97		if err != nil {
98			// TODO: Handle error.
99		}
100		// TODO: Use resp.
101		_ = resp
102	}
103}
104
105func ExampleVizierClient_DeleteStudy() {
106	ctx := context.Background()
107	c, err := aiplatform.NewVizierClient(ctx)
108	if err != nil {
109		// TODO: Handle error.
110	}
111	defer c.Close()
112
113	req := &aiplatformpb.DeleteStudyRequest{
114		// TODO: Fill request struct fields.
115		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteStudyRequest.
116	}
117	err = c.DeleteStudy(ctx, req)
118	if err != nil {
119		// TODO: Handle error.
120	}
121}
122
123func ExampleVizierClient_LookupStudy() {
124	ctx := context.Background()
125	c, err := aiplatform.NewVizierClient(ctx)
126	if err != nil {
127		// TODO: Handle error.
128	}
129	defer c.Close()
130
131	req := &aiplatformpb.LookupStudyRequest{
132		// TODO: Fill request struct fields.
133		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#LookupStudyRequest.
134	}
135	resp, err := c.LookupStudy(ctx, req)
136	if err != nil {
137		// TODO: Handle error.
138	}
139	// TODO: Use resp.
140	_ = resp
141}
142
143func ExampleVizierClient_SuggestTrials() {
144	ctx := context.Background()
145	c, err := aiplatform.NewVizierClient(ctx)
146	if err != nil {
147		// TODO: Handle error.
148	}
149	defer c.Close()
150
151	req := &aiplatformpb.SuggestTrialsRequest{
152		// TODO: Fill request struct fields.
153		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#SuggestTrialsRequest.
154	}
155	op, err := c.SuggestTrials(ctx, req)
156	if err != nil {
157		// TODO: Handle error.
158	}
159
160	resp, err := op.Wait(ctx)
161	if err != nil {
162		// TODO: Handle error.
163	}
164	// TODO: Use resp.
165	_ = resp
166}
167
168func ExampleVizierClient_CreateTrial() {
169	ctx := context.Background()
170	c, err := aiplatform.NewVizierClient(ctx)
171	if err != nil {
172		// TODO: Handle error.
173	}
174	defer c.Close()
175
176	req := &aiplatformpb.CreateTrialRequest{
177		// TODO: Fill request struct fields.
178		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateTrialRequest.
179	}
180	resp, err := c.CreateTrial(ctx, req)
181	if err != nil {
182		// TODO: Handle error.
183	}
184	// TODO: Use resp.
185	_ = resp
186}
187
188func ExampleVizierClient_GetTrial() {
189	ctx := context.Background()
190	c, err := aiplatform.NewVizierClient(ctx)
191	if err != nil {
192		// TODO: Handle error.
193	}
194	defer c.Close()
195
196	req := &aiplatformpb.GetTrialRequest{
197		// TODO: Fill request struct fields.
198		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetTrialRequest.
199	}
200	resp, err := c.GetTrial(ctx, req)
201	if err != nil {
202		// TODO: Handle error.
203	}
204	// TODO: Use resp.
205	_ = resp
206}
207
208func ExampleVizierClient_ListTrials() {
209	ctx := context.Background()
210	c, err := aiplatform.NewVizierClient(ctx)
211	if err != nil {
212		// TODO: Handle error.
213	}
214	defer c.Close()
215
216	req := &aiplatformpb.ListTrialsRequest{
217		// TODO: Fill request struct fields.
218		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListTrialsRequest.
219	}
220	it := c.ListTrials(ctx, req)
221	for {
222		resp, err := it.Next()
223		if err == iterator.Done {
224			break
225		}
226		if err != nil {
227			// TODO: Handle error.
228		}
229		// TODO: Use resp.
230		_ = resp
231	}
232}
233
234func ExampleVizierClient_AddTrialMeasurement() {
235	ctx := context.Background()
236	c, err := aiplatform.NewVizierClient(ctx)
237	if err != nil {
238		// TODO: Handle error.
239	}
240	defer c.Close()
241
242	req := &aiplatformpb.AddTrialMeasurementRequest{
243		// TODO: Fill request struct fields.
244		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#AddTrialMeasurementRequest.
245	}
246	resp, err := c.AddTrialMeasurement(ctx, req)
247	if err != nil {
248		// TODO: Handle error.
249	}
250	// TODO: Use resp.
251	_ = resp
252}
253
254func ExampleVizierClient_CompleteTrial() {
255	ctx := context.Background()
256	c, err := aiplatform.NewVizierClient(ctx)
257	if err != nil {
258		// TODO: Handle error.
259	}
260	defer c.Close()
261
262	req := &aiplatformpb.CompleteTrialRequest{
263		// TODO: Fill request struct fields.
264		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CompleteTrialRequest.
265	}
266	resp, err := c.CompleteTrial(ctx, req)
267	if err != nil {
268		// TODO: Handle error.
269	}
270	// TODO: Use resp.
271	_ = resp
272}
273
274func ExampleVizierClient_DeleteTrial() {
275	ctx := context.Background()
276	c, err := aiplatform.NewVizierClient(ctx)
277	if err != nil {
278		// TODO: Handle error.
279	}
280	defer c.Close()
281
282	req := &aiplatformpb.DeleteTrialRequest{
283		// TODO: Fill request struct fields.
284		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteTrialRequest.
285	}
286	err = c.DeleteTrial(ctx, req)
287	if err != nil {
288		// TODO: Handle error.
289	}
290}
291
292func ExampleVizierClient_CheckTrialEarlyStoppingState() {
293	ctx := context.Background()
294	c, err := aiplatform.NewVizierClient(ctx)
295	if err != nil {
296		// TODO: Handle error.
297	}
298	defer c.Close()
299
300	req := &aiplatformpb.CheckTrialEarlyStoppingStateRequest{
301		// TODO: Fill request struct fields.
302		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CheckTrialEarlyStoppingStateRequest.
303	}
304	op, err := c.CheckTrialEarlyStoppingState(ctx, req)
305	if err != nil {
306		// TODO: Handle error.
307	}
308
309	resp, err := op.Wait(ctx)
310	if err != nil {
311		// TODO: Handle error.
312	}
313	// TODO: Use resp.
314	_ = resp
315}
316
317func ExampleVizierClient_StopTrial() {
318	ctx := context.Background()
319	c, err := aiplatform.NewVizierClient(ctx)
320	if err != nil {
321		// TODO: Handle error.
322	}
323	defer c.Close()
324
325	req := &aiplatformpb.StopTrialRequest{
326		// TODO: Fill request struct fields.
327		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#StopTrialRequest.
328	}
329	resp, err := c.StopTrial(ctx, req)
330	if err != nil {
331		// TODO: Handle error.
332	}
333	// TODO: Use resp.
334	_ = resp
335}
336
337func ExampleVizierClient_ListOptimalTrials() {
338	ctx := context.Background()
339	c, err := aiplatform.NewVizierClient(ctx)
340	if err != nil {
341		// TODO: Handle error.
342	}
343	defer c.Close()
344
345	req := &aiplatformpb.ListOptimalTrialsRequest{
346		// TODO: Fill request struct fields.
347		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListOptimalTrialsRequest.
348	}
349	resp, err := c.ListOptimalTrials(ctx, req)
350	if err != nil {
351		// TODO: Handle error.
352	}
353	// TODO: Use resp.
354	_ = resp
355}
356