blob: 0f0f63aa1acd37cdc1547b1c5fb81a81a4c6bfe5 [file] [log] [blame]
// 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 datastream_test
import (
"context"
datastream "cloud.google.com/go/datastream/apiv1"
"google.golang.org/api/iterator"
datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func ExampleNewClient() {
ctx := context.Background()
c, err := datastream.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func ExampleClient_ListConnectionProfiles() {
ctx := context.Background()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#GetConnectionProfileRequest.
}
resp, err := c.GetConnectionProfile(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateConnectionProfile() {
ctx := context.Background()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#DiscoverConnectionProfileRequest.
}
resp, err := c.DiscoverConnectionProfile(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ListStreams() {
ctx := context.Background()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#GetStreamRequest.
}
resp, err := c.GetStream(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateStream() {
ctx := context.Background()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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_GetStreamObject() {
ctx := context.Background()
c, err := datastream.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &datastreampb.GetStreamObjectRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1#GetStreamObjectRequest.
}
resp, err := c.GetStreamObject(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_LookupStreamObject() {
ctx := context.Background()
c, err := datastream.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &datastreampb.LookupStreamObjectRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1#LookupStreamObjectRequest.
}
resp, err := c.LookupStreamObject(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ListStreamObjects() {
ctx := context.Background()
c, err := datastream.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &datastreampb.ListStreamObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1#ListStreamObjectsRequest.
}
it := c.ListStreamObjects(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleClient_StartBackfillJob() {
ctx := context.Background()
c, err := datastream.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &datastreampb.StartBackfillJobRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1#StartBackfillJobRequest.
}
resp, err := c.StartBackfillJob(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_StopBackfillJob() {
ctx := context.Background()
c, err := datastream.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &datastreampb.StopBackfillJobRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1#StopBackfillJobRequest.
}
resp, err := c.StopBackfillJob(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_FetchStaticIps() {
ctx := context.Background()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#GetPrivateConnectionRequest.
}
resp, err := c.GetPrivateConnection(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ListPrivateConnections() {
ctx := context.Background()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#GetRouteRequest.
}
resp, err := c.GetRoute(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ListRoutes() {
ctx := context.Background()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#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()
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/google.golang.org/genproto/googleapis/cloud/datastream/v1#DeleteRouteRequest.
}
op, err := c.DeleteRoute(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_GetLocation() {
ctx := context.Background()
c, err := datastream.NewClient(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 ExampleClient_ListLocations() {
ctx := context.Background()
c, err := datastream.NewClient(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
}
}