You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

594 lines
11 KiB

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