| // 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 datastream_test |
| |
| import ( |
| "context" |
| |
| datastream "cloud.google.com/go/datastream/apiv1alpha1" |
| datastreampb "cloud.google.com/go/datastream/apiv1alpha1/datastreampb" |
| "google.golang.org/api/iterator" |
| ) |
| |
| func ExampleNewClient() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| // TODO: Use client. |
| _ = c |
| } |
| |
| func ExampleNewRESTClient() { |
| 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 := datastream.NewRESTClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| // TODO: Use client. |
| _ = c |
| } |
| |
| func ExampleClient_ListConnectionProfiles() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.ListConnectionProfilesRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#ListConnectionProfilesRequest. |
| } |
| it := c.ListConnectionProfiles(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleClient_GetConnectionProfile() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.GetConnectionProfileRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#GetConnectionProfileRequest. |
| } |
| resp, err := c.GetConnectionProfile(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_CreateConnectionProfile() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.CreateConnectionProfileRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#CreateConnectionProfileRequest. |
| } |
| op, err := c.CreateConnectionProfile(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_UpdateConnectionProfile() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.UpdateConnectionProfileRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#UpdateConnectionProfileRequest. |
| } |
| op, err := c.UpdateConnectionProfile(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_DeleteConnectionProfile() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.DeleteConnectionProfileRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#DeleteConnectionProfileRequest. |
| } |
| op, err := c.DeleteConnectionProfile(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| err = op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |
| |
| func ExampleClient_DiscoverConnectionProfile() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.DiscoverConnectionProfileRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#DiscoverConnectionProfileRequest. |
| } |
| resp, err := c.DiscoverConnectionProfile(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_ListStreams() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.ListStreamsRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#ListStreamsRequest. |
| } |
| it := c.ListStreams(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleClient_GetStream() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.GetStreamRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#GetStreamRequest. |
| } |
| resp, err := c.GetStream(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_CreateStream() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.CreateStreamRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#CreateStreamRequest. |
| } |
| op, err := c.CreateStream(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_UpdateStream() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.UpdateStreamRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#UpdateStreamRequest. |
| } |
| op, err := c.UpdateStream(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_DeleteStream() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.DeleteStreamRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#DeleteStreamRequest. |
| } |
| op, err := c.DeleteStream(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| err = op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |
| |
| func ExampleClient_FetchErrors() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.FetchErrorsRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#FetchErrorsRequest. |
| } |
| op, err := c.FetchErrors(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_FetchStaticIps() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.FetchStaticIpsRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#FetchStaticIpsRequest. |
| } |
| it := c.FetchStaticIps(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleClient_CreatePrivateConnection() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.CreatePrivateConnectionRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#CreatePrivateConnectionRequest. |
| } |
| op, err := c.CreatePrivateConnection(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_GetPrivateConnection() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.GetPrivateConnectionRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#GetPrivateConnectionRequest. |
| } |
| resp, err := c.GetPrivateConnection(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_ListPrivateConnections() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.ListPrivateConnectionsRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#ListPrivateConnectionsRequest. |
| } |
| it := c.ListPrivateConnections(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleClient_DeletePrivateConnection() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.DeletePrivateConnectionRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#DeletePrivateConnectionRequest. |
| } |
| op, err := c.DeletePrivateConnection(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| err = op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |
| |
| func ExampleClient_CreateRoute() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.CreateRouteRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#CreateRouteRequest. |
| } |
| op, err := c.CreateRoute(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_GetRoute() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.GetRouteRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#GetRouteRequest. |
| } |
| resp, err := c.GetRoute(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_ListRoutes() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.ListRoutesRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#ListRoutesRequest. |
| } |
| it := c.ListRoutes(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleClient_DeleteRoute() { |
| 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 := datastream.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &datastreampb.DeleteRouteRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/cloud.google.com/go/datastream/apiv1alpha1/datastreampb#DeleteRouteRequest. |
| } |
| op, err := c.DeleteRoute(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| err = op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |