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 logging_test 18 19import ( 20 "context" 21 22 logging "cloud.google.com/go/logging/apiv2" 23 "google.golang.org/api/iterator" 24 loggingpb "google.golang.org/genproto/googleapis/logging/v2" 25) 26 27func ExampleNewConfigClient() { 28 ctx := context.Background() 29 c, err := logging.NewConfigClient(ctx) 30 if err != nil { 31 // TODO: Handle error. 32 } 33 // TODO: Use client. 34 _ = c 35} 36 37func ExampleConfigClient_ListBuckets() { 38 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 39 // import "google.golang.org/api/iterator" 40 41 ctx := context.Background() 42 c, err := logging.NewConfigClient(ctx) 43 if err != nil { 44 // TODO: Handle error. 45 } 46 47 req := &loggingpb.ListBucketsRequest{ 48 // TODO: Fill request struct fields. 49 } 50 it := c.ListBuckets(ctx, req) 51 for { 52 resp, err := it.Next() 53 if err == iterator.Done { 54 break 55 } 56 if err != nil { 57 // TODO: Handle error. 58 } 59 // TODO: Use resp. 60 _ = resp 61 } 62} 63 64func ExampleConfigClient_GetBucket() { 65 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 66 67 ctx := context.Background() 68 c, err := logging.NewConfigClient(ctx) 69 if err != nil { 70 // TODO: Handle error. 71 } 72 73 req := &loggingpb.GetBucketRequest{ 74 // TODO: Fill request struct fields. 75 } 76 resp, err := c.GetBucket(ctx, req) 77 if err != nil { 78 // TODO: Handle error. 79 } 80 // TODO: Use resp. 81 _ = resp 82} 83 84func ExampleConfigClient_CreateBucket() { 85 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 86 87 ctx := context.Background() 88 c, err := logging.NewConfigClient(ctx) 89 if err != nil { 90 // TODO: Handle error. 91 } 92 93 req := &loggingpb.CreateBucketRequest{ 94 // TODO: Fill request struct fields. 95 } 96 resp, err := c.CreateBucket(ctx, req) 97 if err != nil { 98 // TODO: Handle error. 99 } 100 // TODO: Use resp. 101 _ = resp 102} 103 104func ExampleConfigClient_UpdateBucket() { 105 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 106 107 ctx := context.Background() 108 c, err := logging.NewConfigClient(ctx) 109 if err != nil { 110 // TODO: Handle error. 111 } 112 113 req := &loggingpb.UpdateBucketRequest{ 114 // TODO: Fill request struct fields. 115 } 116 resp, err := c.UpdateBucket(ctx, req) 117 if err != nil { 118 // TODO: Handle error. 119 } 120 // TODO: Use resp. 121 _ = resp 122} 123 124func ExampleConfigClient_DeleteBucket() { 125 ctx := context.Background() 126 c, err := logging.NewConfigClient(ctx) 127 if err != nil { 128 // TODO: Handle error. 129 } 130 131 req := &loggingpb.DeleteBucketRequest{ 132 // TODO: Fill request struct fields. 133 } 134 err = c.DeleteBucket(ctx, req) 135 if err != nil { 136 // TODO: Handle error. 137 } 138} 139 140func ExampleConfigClient_UndeleteBucket() { 141 ctx := context.Background() 142 c, err := logging.NewConfigClient(ctx) 143 if err != nil { 144 // TODO: Handle error. 145 } 146 147 req := &loggingpb.UndeleteBucketRequest{ 148 // TODO: Fill request struct fields. 149 } 150 err = c.UndeleteBucket(ctx, req) 151 if err != nil { 152 // TODO: Handle error. 153 } 154} 155 156func ExampleConfigClient_ListViews() { 157 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 158 // import "google.golang.org/api/iterator" 159 160 ctx := context.Background() 161 c, err := logging.NewConfigClient(ctx) 162 if err != nil { 163 // TODO: Handle error. 164 } 165 166 req := &loggingpb.ListViewsRequest{ 167 // TODO: Fill request struct fields. 168 } 169 it := c.ListViews(ctx, req) 170 for { 171 resp, err := it.Next() 172 if err == iterator.Done { 173 break 174 } 175 if err != nil { 176 // TODO: Handle error. 177 } 178 // TODO: Use resp. 179 _ = resp 180 } 181} 182 183func ExampleConfigClient_GetView() { 184 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 185 186 ctx := context.Background() 187 c, err := logging.NewConfigClient(ctx) 188 if err != nil { 189 // TODO: Handle error. 190 } 191 192 req := &loggingpb.GetViewRequest{ 193 // TODO: Fill request struct fields. 194 } 195 resp, err := c.GetView(ctx, req) 196 if err != nil { 197 // TODO: Handle error. 198 } 199 // TODO: Use resp. 200 _ = resp 201} 202 203func ExampleConfigClient_CreateView() { 204 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 205 206 ctx := context.Background() 207 c, err := logging.NewConfigClient(ctx) 208 if err != nil { 209 // TODO: Handle error. 210 } 211 212 req := &loggingpb.CreateViewRequest{ 213 // TODO: Fill request struct fields. 214 } 215 resp, err := c.CreateView(ctx, req) 216 if err != nil { 217 // TODO: Handle error. 218 } 219 // TODO: Use resp. 220 _ = resp 221} 222 223func ExampleConfigClient_UpdateView() { 224 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 225 226 ctx := context.Background() 227 c, err := logging.NewConfigClient(ctx) 228 if err != nil { 229 // TODO: Handle error. 230 } 231 232 req := &loggingpb.UpdateViewRequest{ 233 // TODO: Fill request struct fields. 234 } 235 resp, err := c.UpdateView(ctx, req) 236 if err != nil { 237 // TODO: Handle error. 238 } 239 // TODO: Use resp. 240 _ = resp 241} 242 243func ExampleConfigClient_DeleteView() { 244 ctx := context.Background() 245 c, err := logging.NewConfigClient(ctx) 246 if err != nil { 247 // TODO: Handle error. 248 } 249 250 req := &loggingpb.DeleteViewRequest{ 251 // TODO: Fill request struct fields. 252 } 253 err = c.DeleteView(ctx, req) 254 if err != nil { 255 // TODO: Handle error. 256 } 257} 258 259func ExampleConfigClient_ListSinks() { 260 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 261 // import "google.golang.org/api/iterator" 262 263 ctx := context.Background() 264 c, err := logging.NewConfigClient(ctx) 265 if err != nil { 266 // TODO: Handle error. 267 } 268 269 req := &loggingpb.ListSinksRequest{ 270 // TODO: Fill request struct fields. 271 } 272 it := c.ListSinks(ctx, req) 273 for { 274 resp, err := it.Next() 275 if err == iterator.Done { 276 break 277 } 278 if err != nil { 279 // TODO: Handle error. 280 } 281 // TODO: Use resp. 282 _ = resp 283 } 284} 285 286func ExampleConfigClient_GetSink() { 287 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 288 289 ctx := context.Background() 290 c, err := logging.NewConfigClient(ctx) 291 if err != nil { 292 // TODO: Handle error. 293 } 294 295 req := &loggingpb.GetSinkRequest{ 296 // TODO: Fill request struct fields. 297 } 298 resp, err := c.GetSink(ctx, req) 299 if err != nil { 300 // TODO: Handle error. 301 } 302 // TODO: Use resp. 303 _ = resp 304} 305 306func ExampleConfigClient_CreateSink() { 307 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 308 309 ctx := context.Background() 310 c, err := logging.NewConfigClient(ctx) 311 if err != nil { 312 // TODO: Handle error. 313 } 314 315 req := &loggingpb.CreateSinkRequest{ 316 // TODO: Fill request struct fields. 317 } 318 resp, err := c.CreateSink(ctx, req) 319 if err != nil { 320 // TODO: Handle error. 321 } 322 // TODO: Use resp. 323 _ = resp 324} 325 326func ExampleConfigClient_UpdateSink() { 327 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 328 329 ctx := context.Background() 330 c, err := logging.NewConfigClient(ctx) 331 if err != nil { 332 // TODO: Handle error. 333 } 334 335 req := &loggingpb.UpdateSinkRequest{ 336 // TODO: Fill request struct fields. 337 } 338 resp, err := c.UpdateSink(ctx, req) 339 if err != nil { 340 // TODO: Handle error. 341 } 342 // TODO: Use resp. 343 _ = resp 344} 345 346func ExampleConfigClient_DeleteSink() { 347 ctx := context.Background() 348 c, err := logging.NewConfigClient(ctx) 349 if err != nil { 350 // TODO: Handle error. 351 } 352 353 req := &loggingpb.DeleteSinkRequest{ 354 // TODO: Fill request struct fields. 355 } 356 err = c.DeleteSink(ctx, req) 357 if err != nil { 358 // TODO: Handle error. 359 } 360} 361 362func ExampleConfigClient_ListExclusions() { 363 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 364 // import "google.golang.org/api/iterator" 365 366 ctx := context.Background() 367 c, err := logging.NewConfigClient(ctx) 368 if err != nil { 369 // TODO: Handle error. 370 } 371 372 req := &loggingpb.ListExclusionsRequest{ 373 // TODO: Fill request struct fields. 374 } 375 it := c.ListExclusions(ctx, req) 376 for { 377 resp, err := it.Next() 378 if err == iterator.Done { 379 break 380 } 381 if err != nil { 382 // TODO: Handle error. 383 } 384 // TODO: Use resp. 385 _ = resp 386 } 387} 388 389func ExampleConfigClient_GetExclusion() { 390 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 391 392 ctx := context.Background() 393 c, err := logging.NewConfigClient(ctx) 394 if err != nil { 395 // TODO: Handle error. 396 } 397 398 req := &loggingpb.GetExclusionRequest{ 399 // TODO: Fill request struct fields. 400 } 401 resp, err := c.GetExclusion(ctx, req) 402 if err != nil { 403 // TODO: Handle error. 404 } 405 // TODO: Use resp. 406 _ = resp 407} 408 409func ExampleConfigClient_CreateExclusion() { 410 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 411 412 ctx := context.Background() 413 c, err := logging.NewConfigClient(ctx) 414 if err != nil { 415 // TODO: Handle error. 416 } 417 418 req := &loggingpb.CreateExclusionRequest{ 419 // TODO: Fill request struct fields. 420 } 421 resp, err := c.CreateExclusion(ctx, req) 422 if err != nil { 423 // TODO: Handle error. 424 } 425 // TODO: Use resp. 426 _ = resp 427} 428 429func ExampleConfigClient_UpdateExclusion() { 430 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 431 432 ctx := context.Background() 433 c, err := logging.NewConfigClient(ctx) 434 if err != nil { 435 // TODO: Handle error. 436 } 437 438 req := &loggingpb.UpdateExclusionRequest{ 439 // TODO: Fill request struct fields. 440 } 441 resp, err := c.UpdateExclusion(ctx, req) 442 if err != nil { 443 // TODO: Handle error. 444 } 445 // TODO: Use resp. 446 _ = resp 447} 448 449func ExampleConfigClient_DeleteExclusion() { 450 ctx := context.Background() 451 c, err := logging.NewConfigClient(ctx) 452 if err != nil { 453 // TODO: Handle error. 454 } 455 456 req := &loggingpb.DeleteExclusionRequest{ 457 // TODO: Fill request struct fields. 458 } 459 err = c.DeleteExclusion(ctx, req) 460 if err != nil { 461 // TODO: Handle error. 462 } 463} 464 465func ExampleConfigClient_GetCmekSettings() { 466 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 467 468 ctx := context.Background() 469 c, err := logging.NewConfigClient(ctx) 470 if err != nil { 471 // TODO: Handle error. 472 } 473 474 req := &loggingpb.GetCmekSettingsRequest{ 475 // TODO: Fill request struct fields. 476 } 477 resp, err := c.GetCmekSettings(ctx, req) 478 if err != nil { 479 // TODO: Handle error. 480 } 481 // TODO: Use resp. 482 _ = resp 483} 484 485func ExampleConfigClient_UpdateCmekSettings() { 486 // import loggingpb "google.golang.org/genproto/googleapis/logging/v2" 487 488 ctx := context.Background() 489 c, err := logging.NewConfigClient(ctx) 490 if err != nil { 491 // TODO: Handle error. 492 } 493 494 req := &loggingpb.UpdateCmekSettingsRequest{ 495 // TODO: Fill request struct fields. 496 } 497 resp, err := c.UpdateCmekSettings(ctx, req) 498 if err != nil { 499 // TODO: Handle error. 500 } 501 // TODO: Use resp. 502 _ = resp 503} 504