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 connection_test 18 19import ( 20 "context" 21 22 connection "cloud.google.com/go/bigquery/connection/apiv1" 23 "google.golang.org/api/iterator" 24 connectionpb "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1" 25 iampb "google.golang.org/genproto/googleapis/iam/v1" 26) 27 28func ExampleNewClient() { 29 ctx := context.Background() 30 c, err := connection.NewClient(ctx) 31 if err != nil { 32 // TODO: Handle error. 33 } 34 // TODO: Use client. 35 _ = c 36} 37 38func ExampleClient_CreateConnection() { 39 // import connectionpb "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1" 40 41 ctx := context.Background() 42 c, err := connection.NewClient(ctx) 43 if err != nil { 44 // TODO: Handle error. 45 } 46 47 req := &connectionpb.CreateConnectionRequest{ 48 // TODO: Fill request struct fields. 49 } 50 resp, err := c.CreateConnection(ctx, req) 51 if err != nil { 52 // TODO: Handle error. 53 } 54 // TODO: Use resp. 55 _ = resp 56} 57 58func ExampleClient_GetConnection() { 59 // import connectionpb "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1" 60 61 ctx := context.Background() 62 c, err := connection.NewClient(ctx) 63 if err != nil { 64 // TODO: Handle error. 65 } 66 67 req := &connectionpb.GetConnectionRequest{ 68 // TODO: Fill request struct fields. 69 } 70 resp, err := c.GetConnection(ctx, req) 71 if err != nil { 72 // TODO: Handle error. 73 } 74 // TODO: Use resp. 75 _ = resp 76} 77 78func ExampleClient_ListConnections() { 79 // import connectionpb "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1" 80 // import "google.golang.org/api/iterator" 81 82 ctx := context.Background() 83 c, err := connection.NewClient(ctx) 84 if err != nil { 85 // TODO: Handle error. 86 } 87 88 req := &connectionpb.ListConnectionsRequest{ 89 // TODO: Fill request struct fields. 90 } 91 it := c.ListConnections(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 ExampleClient_UpdateConnection() { 106 // import connectionpb "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1" 107 108 ctx := context.Background() 109 c, err := connection.NewClient(ctx) 110 if err != nil { 111 // TODO: Handle error. 112 } 113 114 req := &connectionpb.UpdateConnectionRequest{ 115 // TODO: Fill request struct fields. 116 } 117 resp, err := c.UpdateConnection(ctx, req) 118 if err != nil { 119 // TODO: Handle error. 120 } 121 // TODO: Use resp. 122 _ = resp 123} 124 125func ExampleClient_DeleteConnection() { 126 ctx := context.Background() 127 c, err := connection.NewClient(ctx) 128 if err != nil { 129 // TODO: Handle error. 130 } 131 132 req := &connectionpb.DeleteConnectionRequest{ 133 // TODO: Fill request struct fields. 134 } 135 err = c.DeleteConnection(ctx, req) 136 if err != nil { 137 // TODO: Handle error. 138 } 139} 140 141func ExampleClient_GetIamPolicy() { 142 // import iampb "google.golang.org/genproto/googleapis/iam/v1" 143 144 ctx := context.Background() 145 c, err := connection.NewClient(ctx) 146 if err != nil { 147 // TODO: Handle error. 148 } 149 150 req := &iampb.GetIamPolicyRequest{ 151 // TODO: Fill request struct fields. 152 } 153 resp, err := c.GetIamPolicy(ctx, req) 154 if err != nil { 155 // TODO: Handle error. 156 } 157 // TODO: Use resp. 158 _ = resp 159} 160 161func ExampleClient_SetIamPolicy() { 162 // import iampb "google.golang.org/genproto/googleapis/iam/v1" 163 164 ctx := context.Background() 165 c, err := connection.NewClient(ctx) 166 if err != nil { 167 // TODO: Handle error. 168 } 169 170 req := &iampb.SetIamPolicyRequest{ 171 // TODO: Fill request struct fields. 172 } 173 resp, err := c.SetIamPolicy(ctx, req) 174 if err != nil { 175 // TODO: Handle error. 176 } 177 // TODO: Use resp. 178 _ = resp 179} 180 181func ExampleClient_TestIamPermissions() { 182 // import iampb "google.golang.org/genproto/googleapis/iam/v1" 183 184 ctx := context.Background() 185 c, err := connection.NewClient(ctx) 186 if err != nil { 187 // TODO: Handle error. 188 } 189 190 req := &iampb.TestIamPermissionsRequest{ 191 // TODO: Fill request struct fields. 192 } 193 resp, err := c.TestIamPermissions(ctx, req) 194 if err != nil { 195 // TODO: Handle error. 196 } 197 // TODO: Use resp. 198 _ = resp 199} 200