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