blob: a2e5336fe0a1e3fafecd1fac4dfce1c0f286a634 [file] [log] [blame]
// Copyright 2023 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 alloydb_test
import (
"context"
alloydb "cloud.google.com/go/alloydb/apiv1alpha"
alloydbpb "cloud.google.com/go/alloydb/apiv1alpha/alloydbpb"
"cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func ExampleNewAlloyDBAdminClient() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func ExampleNewAlloyDBAdminRESTClient() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func ExampleAlloyDBAdminClient_ListClusters() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.ListClustersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#ListClustersRequest.
}
it := c.ListClusters(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAlloyDBAdminClient_GetCluster() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.GetClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#GetClusterRequest.
}
resp, err := c.GetCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_CreateCluster() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.CreateClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#CreateClusterRequest.
}
op, err := c.CreateCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_UpdateCluster() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.UpdateClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#UpdateClusterRequest.
}
op, err := c.UpdateCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_DeleteCluster() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.DeleteClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#DeleteClusterRequest.
}
op, err := c.DeleteCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func ExampleAlloyDBAdminClient_PromoteCluster() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.PromoteClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#PromoteClusterRequest.
}
op, err := c.PromoteCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_RestoreCluster() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.RestoreClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#RestoreClusterRequest.
}
op, err := c.RestoreCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_CreateSecondaryCluster() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.CreateSecondaryClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#CreateSecondaryClusterRequest.
}
op, err := c.CreateSecondaryCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_ListInstances() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.ListInstancesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#ListInstancesRequest.
}
it := c.ListInstances(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAlloyDBAdminClient_GetInstance() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.GetInstanceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#GetInstanceRequest.
}
resp, err := c.GetInstance(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_CreateInstance() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.CreateInstanceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#CreateInstanceRequest.
}
op, err := c.CreateInstance(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_CreateSecondaryInstance() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.CreateSecondaryInstanceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#CreateSecondaryInstanceRequest.
}
op, err := c.CreateSecondaryInstance(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_BatchCreateInstances() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.BatchCreateInstancesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#BatchCreateInstancesRequest.
}
op, err := c.BatchCreateInstances(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_UpdateInstance() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.UpdateInstanceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#UpdateInstanceRequest.
}
op, err := c.UpdateInstance(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_DeleteInstance() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.DeleteInstanceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#DeleteInstanceRequest.
}
op, err := c.DeleteInstance(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func ExampleAlloyDBAdminClient_FailoverInstance() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.FailoverInstanceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#FailoverInstanceRequest.
}
op, err := c.FailoverInstance(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_RestartInstance() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.RestartInstanceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#RestartInstanceRequest.
}
op, err := c.RestartInstance(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_ListBackups() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.ListBackupsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#ListBackupsRequest.
}
it := c.ListBackups(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAlloyDBAdminClient_GetBackup() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.GetBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#GetBackupRequest.
}
resp, err := c.GetBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_CreateBackup() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.CreateBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#CreateBackupRequest.
}
op, err := c.CreateBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_UpdateBackup() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.UpdateBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#UpdateBackupRequest.
}
op, err := c.UpdateBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_DeleteBackup() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.DeleteBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#DeleteBackupRequest.
}
op, err := c.DeleteBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func ExampleAlloyDBAdminClient_ListSupportedDatabaseFlags() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.ListSupportedDatabaseFlagsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#ListSupportedDatabaseFlagsRequest.
}
it := c.ListSupportedDatabaseFlags(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAlloyDBAdminClient_GenerateClientCertificate() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.GenerateClientCertificateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#GenerateClientCertificateRequest.
}
resp, err := c.GenerateClientCertificate(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_GetConnectionInfo() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &alloydbpb.GetConnectionInfoRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/alloydb/apiv1alpha/alloydbpb#GetConnectionInfoRequest.
}
resp, err := c.GetConnectionInfo(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_GetLocation() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_ListLocations() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAlloyDBAdminClient_CancelOperation() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleAlloyDBAdminClient_DeleteOperation() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleAlloyDBAdminClient_GetOperation() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAlloyDBAdminClient_ListOperations() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := alloydb.NewAlloyDBAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}