| // Copyright 2022 Google LLC |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // https://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // Code generated by protoc-gen-go_gapic. DO NOT EDIT. |
| |
| package aiplatform_test |
| |
| import ( |
| "context" |
| |
| aiplatform "cloud.google.com/go/aiplatform/apiv1" |
| "google.golang.org/api/iterator" |
| aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" |
| ) |
| |
| func ExampleNewVizierClient() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| // TODO: Use client. |
| _ = c |
| } |
| |
| func ExampleVizierClient_CreateStudy() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.CreateStudyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateStudyRequest. |
| } |
| resp, err := c.CreateStudy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_GetStudy() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.GetStudyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetStudyRequest. |
| } |
| resp, err := c.GetStudy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_ListStudies() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.ListStudiesRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListStudiesRequest. |
| } |
| it := c.ListStudies(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleVizierClient_DeleteStudy() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.DeleteStudyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteStudyRequest. |
| } |
| err = c.DeleteStudy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |
| |
| func ExampleVizierClient_LookupStudy() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.LookupStudyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#LookupStudyRequest. |
| } |
| resp, err := c.LookupStudy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_SuggestTrials() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.SuggestTrialsRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#SuggestTrialsRequest. |
| } |
| op, err := c.SuggestTrials(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_CreateTrial() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.CreateTrialRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateTrialRequest. |
| } |
| resp, err := c.CreateTrial(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_GetTrial() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.GetTrialRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetTrialRequest. |
| } |
| resp, err := c.GetTrial(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_ListTrials() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.ListTrialsRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListTrialsRequest. |
| } |
| it := c.ListTrials(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleVizierClient_AddTrialMeasurement() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.AddTrialMeasurementRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#AddTrialMeasurementRequest. |
| } |
| resp, err := c.AddTrialMeasurement(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_CompleteTrial() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.CompleteTrialRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CompleteTrialRequest. |
| } |
| resp, err := c.CompleteTrial(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_DeleteTrial() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.DeleteTrialRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteTrialRequest. |
| } |
| err = c.DeleteTrial(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |
| |
| func ExampleVizierClient_CheckTrialEarlyStoppingState() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.CheckTrialEarlyStoppingStateRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CheckTrialEarlyStoppingStateRequest. |
| } |
| op, err := c.CheckTrialEarlyStoppingState(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_StopTrial() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.StopTrialRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#StopTrialRequest. |
| } |
| resp, err := c.StopTrial(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleVizierClient_ListOptimalTrials() { |
| ctx := context.Background() |
| c, err := aiplatform.NewVizierClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &aiplatformpb.ListOptimalTrialsRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListOptimalTrialsRequest. |
| } |
| resp, err := c.ListOptimalTrials(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |