1// Copyright 2019 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 gapic-generator. DO NOT EDIT. 16 17package dlp_test 18 19import ( 20 "context" 21 22 dlp "cloud.google.com/go/dlp/apiv2" 23 "google.golang.org/api/iterator" 24 dlppb "google.golang.org/genproto/googleapis/privacy/dlp/v2" 25) 26 27func ExampleNewClient() { 28 ctx := context.Background() 29 c, err := dlp.NewClient(ctx) 30 if err != nil { 31 // TODO: Handle error. 32 } 33 // TODO: Use client. 34 _ = c 35} 36 37func ExampleClient_InspectContent() { 38 ctx := context.Background() 39 c, err := dlp.NewClient(ctx) 40 if err != nil { 41 // TODO: Handle error. 42 } 43 44 req := &dlppb.InspectContentRequest{ 45 // TODO: Fill request struct fields. 46 } 47 resp, err := c.InspectContent(ctx, req) 48 if err != nil { 49 // TODO: Handle error. 50 } 51 // TODO: Use resp. 52 _ = resp 53} 54 55func ExampleClient_RedactImage() { 56 ctx := context.Background() 57 c, err := dlp.NewClient(ctx) 58 if err != nil { 59 // TODO: Handle error. 60 } 61 62 req := &dlppb.RedactImageRequest{ 63 // TODO: Fill request struct fields. 64 } 65 resp, err := c.RedactImage(ctx, req) 66 if err != nil { 67 // TODO: Handle error. 68 } 69 // TODO: Use resp. 70 _ = resp 71} 72 73func ExampleClient_DeidentifyContent() { 74 ctx := context.Background() 75 c, err := dlp.NewClient(ctx) 76 if err != nil { 77 // TODO: Handle error. 78 } 79 80 req := &dlppb.DeidentifyContentRequest{ 81 // TODO: Fill request struct fields. 82 } 83 resp, err := c.DeidentifyContent(ctx, req) 84 if err != nil { 85 // TODO: Handle error. 86 } 87 // TODO: Use resp. 88 _ = resp 89} 90 91func ExampleClient_ReidentifyContent() { 92 ctx := context.Background() 93 c, err := dlp.NewClient(ctx) 94 if err != nil { 95 // TODO: Handle error. 96 } 97 98 req := &dlppb.ReidentifyContentRequest{ 99 // TODO: Fill request struct fields. 100 } 101 resp, err := c.ReidentifyContent(ctx, req) 102 if err != nil { 103 // TODO: Handle error. 104 } 105 // TODO: Use resp. 106 _ = resp 107} 108 109func ExampleClient_ListInfoTypes() { 110 ctx := context.Background() 111 c, err := dlp.NewClient(ctx) 112 if err != nil { 113 // TODO: Handle error. 114 } 115 116 req := &dlppb.ListInfoTypesRequest{ 117 // TODO: Fill request struct fields. 118 } 119 resp, err := c.ListInfoTypes(ctx, req) 120 if err != nil { 121 // TODO: Handle error. 122 } 123 // TODO: Use resp. 124 _ = resp 125} 126 127func ExampleClient_CreateInspectTemplate() { 128 ctx := context.Background() 129 c, err := dlp.NewClient(ctx) 130 if err != nil { 131 // TODO: Handle error. 132 } 133 134 req := &dlppb.CreateInspectTemplateRequest{ 135 // TODO: Fill request struct fields. 136 } 137 resp, err := c.CreateInspectTemplate(ctx, req) 138 if err != nil { 139 // TODO: Handle error. 140 } 141 // TODO: Use resp. 142 _ = resp 143} 144 145func ExampleClient_UpdateInspectTemplate() { 146 ctx := context.Background() 147 c, err := dlp.NewClient(ctx) 148 if err != nil { 149 // TODO: Handle error. 150 } 151 152 req := &dlppb.UpdateInspectTemplateRequest{ 153 // TODO: Fill request struct fields. 154 } 155 resp, err := c.UpdateInspectTemplate(ctx, req) 156 if err != nil { 157 // TODO: Handle error. 158 } 159 // TODO: Use resp. 160 _ = resp 161} 162 163func ExampleClient_GetInspectTemplate() { 164 ctx := context.Background() 165 c, err := dlp.NewClient(ctx) 166 if err != nil { 167 // TODO: Handle error. 168 } 169 170 req := &dlppb.GetInspectTemplateRequest{ 171 // TODO: Fill request struct fields. 172 } 173 resp, err := c.GetInspectTemplate(ctx, req) 174 if err != nil { 175 // TODO: Handle error. 176 } 177 // TODO: Use resp. 178 _ = resp 179} 180 181func ExampleClient_ListInspectTemplates() { 182 ctx := context.Background() 183 c, err := dlp.NewClient(ctx) 184 if err != nil { 185 // TODO: Handle error. 186 } 187 188 req := &dlppb.ListInspectTemplatesRequest{ 189 // TODO: Fill request struct fields. 190 } 191 it := c.ListInspectTemplates(ctx, req) 192 for { 193 resp, err := it.Next() 194 if err == iterator.Done { 195 break 196 } 197 if err != nil { 198 // TODO: Handle error. 199 } 200 // TODO: Use resp. 201 _ = resp 202 } 203} 204 205func ExampleClient_DeleteInspectTemplate() { 206 ctx := context.Background() 207 c, err := dlp.NewClient(ctx) 208 if err != nil { 209 // TODO: Handle error. 210 } 211 212 req := &dlppb.DeleteInspectTemplateRequest{ 213 // TODO: Fill request struct fields. 214 } 215 err = c.DeleteInspectTemplate(ctx, req) 216 if err != nil { 217 // TODO: Handle error. 218 } 219} 220 221func ExampleClient_CreateDeidentifyTemplate() { 222 ctx := context.Background() 223 c, err := dlp.NewClient(ctx) 224 if err != nil { 225 // TODO: Handle error. 226 } 227 228 req := &dlppb.CreateDeidentifyTemplateRequest{ 229 // TODO: Fill request struct fields. 230 } 231 resp, err := c.CreateDeidentifyTemplate(ctx, req) 232 if err != nil { 233 // TODO: Handle error. 234 } 235 // TODO: Use resp. 236 _ = resp 237} 238 239func ExampleClient_UpdateDeidentifyTemplate() { 240 ctx := context.Background() 241 c, err := dlp.NewClient(ctx) 242 if err != nil { 243 // TODO: Handle error. 244 } 245 246 req := &dlppb.UpdateDeidentifyTemplateRequest{ 247 // TODO: Fill request struct fields. 248 } 249 resp, err := c.UpdateDeidentifyTemplate(ctx, req) 250 if err != nil { 251 // TODO: Handle error. 252 } 253 // TODO: Use resp. 254 _ = resp 255} 256 257func ExampleClient_GetDeidentifyTemplate() { 258 ctx := context.Background() 259 c, err := dlp.NewClient(ctx) 260 if err != nil { 261 // TODO: Handle error. 262 } 263 264 req := &dlppb.GetDeidentifyTemplateRequest{ 265 // TODO: Fill request struct fields. 266 } 267 resp, err := c.GetDeidentifyTemplate(ctx, req) 268 if err != nil { 269 // TODO: Handle error. 270 } 271 // TODO: Use resp. 272 _ = resp 273} 274 275func ExampleClient_ListDeidentifyTemplates() { 276 ctx := context.Background() 277 c, err := dlp.NewClient(ctx) 278 if err != nil { 279 // TODO: Handle error. 280 } 281 282 req := &dlppb.ListDeidentifyTemplatesRequest{ 283 // TODO: Fill request struct fields. 284 } 285 it := c.ListDeidentifyTemplates(ctx, req) 286 for { 287 resp, err := it.Next() 288 if err == iterator.Done { 289 break 290 } 291 if err != nil { 292 // TODO: Handle error. 293 } 294 // TODO: Use resp. 295 _ = resp 296 } 297} 298 299func ExampleClient_DeleteDeidentifyTemplate() { 300 ctx := context.Background() 301 c, err := dlp.NewClient(ctx) 302 if err != nil { 303 // TODO: Handle error. 304 } 305 306 req := &dlppb.DeleteDeidentifyTemplateRequest{ 307 // TODO: Fill request struct fields. 308 } 309 err = c.DeleteDeidentifyTemplate(ctx, req) 310 if err != nil { 311 // TODO: Handle error. 312 } 313} 314 315func ExampleClient_CreateDlpJob() { 316 ctx := context.Background() 317 c, err := dlp.NewClient(ctx) 318 if err != nil { 319 // TODO: Handle error. 320 } 321 322 req := &dlppb.CreateDlpJobRequest{ 323 // TODO: Fill request struct fields. 324 } 325 resp, err := c.CreateDlpJob(ctx, req) 326 if err != nil { 327 // TODO: Handle error. 328 } 329 // TODO: Use resp. 330 _ = resp 331} 332 333func ExampleClient_ListDlpJobs() { 334 ctx := context.Background() 335 c, err := dlp.NewClient(ctx) 336 if err != nil { 337 // TODO: Handle error. 338 } 339 340 req := &dlppb.ListDlpJobsRequest{ 341 // TODO: Fill request struct fields. 342 } 343 it := c.ListDlpJobs(ctx, req) 344 for { 345 resp, err := it.Next() 346 if err == iterator.Done { 347 break 348 } 349 if err != nil { 350 // TODO: Handle error. 351 } 352 // TODO: Use resp. 353 _ = resp 354 } 355} 356 357func ExampleClient_GetDlpJob() { 358 ctx := context.Background() 359 c, err := dlp.NewClient(ctx) 360 if err != nil { 361 // TODO: Handle error. 362 } 363 364 req := &dlppb.GetDlpJobRequest{ 365 // TODO: Fill request struct fields. 366 } 367 resp, err := c.GetDlpJob(ctx, req) 368 if err != nil { 369 // TODO: Handle error. 370 } 371 // TODO: Use resp. 372 _ = resp 373} 374 375func ExampleClient_DeleteDlpJob() { 376 ctx := context.Background() 377 c, err := dlp.NewClient(ctx) 378 if err != nil { 379 // TODO: Handle error. 380 } 381 382 req := &dlppb.DeleteDlpJobRequest{ 383 // TODO: Fill request struct fields. 384 } 385 err = c.DeleteDlpJob(ctx, req) 386 if err != nil { 387 // TODO: Handle error. 388 } 389} 390 391func ExampleClient_CancelDlpJob() { 392 ctx := context.Background() 393 c, err := dlp.NewClient(ctx) 394 if err != nil { 395 // TODO: Handle error. 396 } 397 398 req := &dlppb.CancelDlpJobRequest{ 399 // TODO: Fill request struct fields. 400 } 401 err = c.CancelDlpJob(ctx, req) 402 if err != nil { 403 // TODO: Handle error. 404 } 405} 406 407func ExampleClient_ListJobTriggers() { 408 ctx := context.Background() 409 c, err := dlp.NewClient(ctx) 410 if err != nil { 411 // TODO: Handle error. 412 } 413 414 req := &dlppb.ListJobTriggersRequest{ 415 // TODO: Fill request struct fields. 416 } 417 it := c.ListJobTriggers(ctx, req) 418 for { 419 resp, err := it.Next() 420 if err == iterator.Done { 421 break 422 } 423 if err != nil { 424 // TODO: Handle error. 425 } 426 // TODO: Use resp. 427 _ = resp 428 } 429} 430 431func ExampleClient_GetJobTrigger() { 432 ctx := context.Background() 433 c, err := dlp.NewClient(ctx) 434 if err != nil { 435 // TODO: Handle error. 436 } 437 438 req := &dlppb.GetJobTriggerRequest{ 439 // TODO: Fill request struct fields. 440 } 441 resp, err := c.GetJobTrigger(ctx, req) 442 if err != nil { 443 // TODO: Handle error. 444 } 445 // TODO: Use resp. 446 _ = resp 447} 448 449func ExampleClient_DeleteJobTrigger() { 450 ctx := context.Background() 451 c, err := dlp.NewClient(ctx) 452 if err != nil { 453 // TODO: Handle error. 454 } 455 456 req := &dlppb.DeleteJobTriggerRequest{ 457 // TODO: Fill request struct fields. 458 } 459 err = c.DeleteJobTrigger(ctx, req) 460 if err != nil { 461 // TODO: Handle error. 462 } 463} 464 465func ExampleClient_UpdateJobTrigger() { 466 ctx := context.Background() 467 c, err := dlp.NewClient(ctx) 468 if err != nil { 469 // TODO: Handle error. 470 } 471 472 req := &dlppb.UpdateJobTriggerRequest{ 473 // TODO: Fill request struct fields. 474 } 475 resp, err := c.UpdateJobTrigger(ctx, req) 476 if err != nil { 477 // TODO: Handle error. 478 } 479 // TODO: Use resp. 480 _ = resp 481} 482 483func ExampleClient_CreateJobTrigger() { 484 ctx := context.Background() 485 c, err := dlp.NewClient(ctx) 486 if err != nil { 487 // TODO: Handle error. 488 } 489 490 req := &dlppb.CreateJobTriggerRequest{ 491 // TODO: Fill request struct fields. 492 } 493 resp, err := c.CreateJobTrigger(ctx, req) 494 if err != nil { 495 // TODO: Handle error. 496 } 497 // TODO: Use resp. 498 _ = resp 499} 500 501func ExampleClient_CreateStoredInfoType() { 502 ctx := context.Background() 503 c, err := dlp.NewClient(ctx) 504 if err != nil { 505 // TODO: Handle error. 506 } 507 508 req := &dlppb.CreateStoredInfoTypeRequest{ 509 // TODO: Fill request struct fields. 510 } 511 resp, err := c.CreateStoredInfoType(ctx, req) 512 if err != nil { 513 // TODO: Handle error. 514 } 515 // TODO: Use resp. 516 _ = resp 517} 518 519func ExampleClient_UpdateStoredInfoType() { 520 ctx := context.Background() 521 c, err := dlp.NewClient(ctx) 522 if err != nil { 523 // TODO: Handle error. 524 } 525 526 req := &dlppb.UpdateStoredInfoTypeRequest{ 527 // TODO: Fill request struct fields. 528 } 529 resp, err := c.UpdateStoredInfoType(ctx, req) 530 if err != nil { 531 // TODO: Handle error. 532 } 533 // TODO: Use resp. 534 _ = resp 535} 536 537func ExampleClient_GetStoredInfoType() { 538 ctx := context.Background() 539 c, err := dlp.NewClient(ctx) 540 if err != nil { 541 // TODO: Handle error. 542 } 543 544 req := &dlppb.GetStoredInfoTypeRequest{ 545 // TODO: Fill request struct fields. 546 } 547 resp, err := c.GetStoredInfoType(ctx, req) 548 if err != nil { 549 // TODO: Handle error. 550 } 551 // TODO: Use resp. 552 _ = resp 553} 554 555func ExampleClient_ListStoredInfoTypes() { 556 ctx := context.Background() 557 c, err := dlp.NewClient(ctx) 558 if err != nil { 559 // TODO: Handle error. 560 } 561 562 req := &dlppb.ListStoredInfoTypesRequest{ 563 // TODO: Fill request struct fields. 564 } 565 it := c.ListStoredInfoTypes(ctx, req) 566 for { 567 resp, err := it.Next() 568 if err == iterator.Done { 569 break 570 } 571 if err != nil { 572 // TODO: Handle error. 573 } 574 // TODO: Use resp. 575 _ = resp 576 } 577} 578 579func ExampleClient_DeleteStoredInfoType() { 580 ctx := context.Background() 581 c, err := dlp.NewClient(ctx) 582 if err != nil { 583 // TODO: Handle error. 584 } 585 586 req := &dlppb.DeleteStoredInfoTypeRequest{ 587 // TODO: Fill request struct fields. 588 } 589 err = c.DeleteStoredInfoType(ctx, req) 590 if err != nil { 591 // TODO: Handle error. 592 } 593} 594