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.
 
 
 

320 lines
7.0 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 containeranalysis_test
  16. import (
  17. "context"
  18. containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
  19. "google.golang.org/api/iterator"
  20. grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
  21. )
  22. func ExampleNewGrafeasV1Beta1Client() {
  23. ctx := context.Background()
  24. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleGrafeasV1Beta1Client_GetOccurrence() {
  32. ctx := context.Background()
  33. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &grafeaspb.GetOccurrenceRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. resp, err := c.GetOccurrence(ctx, req)
  41. if err != nil {
  42. // TODO: Handle error.
  43. }
  44. // TODO: Use resp.
  45. _ = resp
  46. }
  47. func ExampleGrafeasV1Beta1Client_ListOccurrences() {
  48. ctx := context.Background()
  49. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  50. if err != nil {
  51. // TODO: Handle error.
  52. }
  53. req := &grafeaspb.ListOccurrencesRequest{
  54. // TODO: Fill request struct fields.
  55. }
  56. it := c.ListOccurrences(ctx, req)
  57. for {
  58. resp, err := it.Next()
  59. if err == iterator.Done {
  60. break
  61. }
  62. if err != nil {
  63. // TODO: Handle error.
  64. }
  65. // TODO: Use resp.
  66. _ = resp
  67. }
  68. }
  69. func ExampleGrafeasV1Beta1Client_DeleteOccurrence() {
  70. ctx := context.Background()
  71. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  72. if err != nil {
  73. // TODO: Handle error.
  74. }
  75. req := &grafeaspb.DeleteOccurrenceRequest{
  76. // TODO: Fill request struct fields.
  77. }
  78. err = c.DeleteOccurrence(ctx, req)
  79. if err != nil {
  80. // TODO: Handle error.
  81. }
  82. }
  83. func ExampleGrafeasV1Beta1Client_CreateOccurrence() {
  84. ctx := context.Background()
  85. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  86. if err != nil {
  87. // TODO: Handle error.
  88. }
  89. req := &grafeaspb.CreateOccurrenceRequest{
  90. // TODO: Fill request struct fields.
  91. }
  92. resp, err := c.CreateOccurrence(ctx, req)
  93. if err != nil {
  94. // TODO: Handle error.
  95. }
  96. // TODO: Use resp.
  97. _ = resp
  98. }
  99. func ExampleGrafeasV1Beta1Client_BatchCreateOccurrences() {
  100. ctx := context.Background()
  101. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  102. if err != nil {
  103. // TODO: Handle error.
  104. }
  105. req := &grafeaspb.BatchCreateOccurrencesRequest{
  106. // TODO: Fill request struct fields.
  107. }
  108. resp, err := c.BatchCreateOccurrences(ctx, req)
  109. if err != nil {
  110. // TODO: Handle error.
  111. }
  112. // TODO: Use resp.
  113. _ = resp
  114. }
  115. func ExampleGrafeasV1Beta1Client_UpdateOccurrence() {
  116. ctx := context.Background()
  117. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  118. if err != nil {
  119. // TODO: Handle error.
  120. }
  121. req := &grafeaspb.UpdateOccurrenceRequest{
  122. // TODO: Fill request struct fields.
  123. }
  124. resp, err := c.UpdateOccurrence(ctx, req)
  125. if err != nil {
  126. // TODO: Handle error.
  127. }
  128. // TODO: Use resp.
  129. _ = resp
  130. }
  131. func ExampleGrafeasV1Beta1Client_GetOccurrenceNote() {
  132. ctx := context.Background()
  133. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  134. if err != nil {
  135. // TODO: Handle error.
  136. }
  137. req := &grafeaspb.GetOccurrenceNoteRequest{
  138. // TODO: Fill request struct fields.
  139. }
  140. resp, err := c.GetOccurrenceNote(ctx, req)
  141. if err != nil {
  142. // TODO: Handle error.
  143. }
  144. // TODO: Use resp.
  145. _ = resp
  146. }
  147. func ExampleGrafeasV1Beta1Client_GetNote() {
  148. ctx := context.Background()
  149. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  150. if err != nil {
  151. // TODO: Handle error.
  152. }
  153. req := &grafeaspb.GetNoteRequest{
  154. // TODO: Fill request struct fields.
  155. }
  156. resp, err := c.GetNote(ctx, req)
  157. if err != nil {
  158. // TODO: Handle error.
  159. }
  160. // TODO: Use resp.
  161. _ = resp
  162. }
  163. func ExampleGrafeasV1Beta1Client_ListNotes() {
  164. ctx := context.Background()
  165. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  166. if err != nil {
  167. // TODO: Handle error.
  168. }
  169. req := &grafeaspb.ListNotesRequest{
  170. // TODO: Fill request struct fields.
  171. }
  172. it := c.ListNotes(ctx, req)
  173. for {
  174. resp, err := it.Next()
  175. if err == iterator.Done {
  176. break
  177. }
  178. if err != nil {
  179. // TODO: Handle error.
  180. }
  181. // TODO: Use resp.
  182. _ = resp
  183. }
  184. }
  185. func ExampleGrafeasV1Beta1Client_DeleteNote() {
  186. ctx := context.Background()
  187. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  188. if err != nil {
  189. // TODO: Handle error.
  190. }
  191. req := &grafeaspb.DeleteNoteRequest{
  192. // TODO: Fill request struct fields.
  193. }
  194. err = c.DeleteNote(ctx, req)
  195. if err != nil {
  196. // TODO: Handle error.
  197. }
  198. }
  199. func ExampleGrafeasV1Beta1Client_CreateNote() {
  200. ctx := context.Background()
  201. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  202. if err != nil {
  203. // TODO: Handle error.
  204. }
  205. req := &grafeaspb.CreateNoteRequest{
  206. // TODO: Fill request struct fields.
  207. }
  208. resp, err := c.CreateNote(ctx, req)
  209. if err != nil {
  210. // TODO: Handle error.
  211. }
  212. // TODO: Use resp.
  213. _ = resp
  214. }
  215. func ExampleGrafeasV1Beta1Client_BatchCreateNotes() {
  216. ctx := context.Background()
  217. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  218. if err != nil {
  219. // TODO: Handle error.
  220. }
  221. req := &grafeaspb.BatchCreateNotesRequest{
  222. // TODO: Fill request struct fields.
  223. }
  224. resp, err := c.BatchCreateNotes(ctx, req)
  225. if err != nil {
  226. // TODO: Handle error.
  227. }
  228. // TODO: Use resp.
  229. _ = resp
  230. }
  231. func ExampleGrafeasV1Beta1Client_UpdateNote() {
  232. ctx := context.Background()
  233. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  234. if err != nil {
  235. // TODO: Handle error.
  236. }
  237. req := &grafeaspb.UpdateNoteRequest{
  238. // TODO: Fill request struct fields.
  239. }
  240. resp, err := c.UpdateNote(ctx, req)
  241. if err != nil {
  242. // TODO: Handle error.
  243. }
  244. // TODO: Use resp.
  245. _ = resp
  246. }
  247. func ExampleGrafeasV1Beta1Client_ListNoteOccurrences() {
  248. ctx := context.Background()
  249. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  250. if err != nil {
  251. // TODO: Handle error.
  252. }
  253. req := &grafeaspb.ListNoteOccurrencesRequest{
  254. // TODO: Fill request struct fields.
  255. }
  256. it := c.ListNoteOccurrences(ctx, req)
  257. for {
  258. resp, err := it.Next()
  259. if err == iterator.Done {
  260. break
  261. }
  262. if err != nil {
  263. // TODO: Handle error.
  264. }
  265. // TODO: Use resp.
  266. _ = resp
  267. }
  268. }
  269. func ExampleGrafeasV1Beta1Client_GetVulnerabilityOccurrencesSummary() {
  270. ctx := context.Background()
  271. c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx)
  272. if err != nil {
  273. // TODO: Handle error.
  274. }
  275. req := &grafeaspb.GetVulnerabilityOccurrencesSummaryRequest{
  276. // TODO: Fill request struct fields.
  277. }
  278. resp, err := c.GetVulnerabilityOccurrencesSummary(ctx, req)
  279. if err != nil {
  280. // TODO: Handle error.
  281. }
  282. // TODO: Use resp.
  283. _ = resp
  284. }