Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

224 righe
4.5 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 logging_test
  16. import (
  17. "context"
  18. logging "cloud.google.com/go/logging/apiv2"
  19. "google.golang.org/api/iterator"
  20. loggingpb "google.golang.org/genproto/googleapis/logging/v2"
  21. )
  22. func ExampleNewConfigClient() {
  23. ctx := context.Background()
  24. c, err := logging.NewConfigClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleConfigClient_ListSinks() {
  32. ctx := context.Background()
  33. c, err := logging.NewConfigClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &loggingpb.ListSinksRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. it := c.ListSinks(ctx, req)
  41. for {
  42. resp, err := it.Next()
  43. if err == iterator.Done {
  44. break
  45. }
  46. if err != nil {
  47. // TODO: Handle error.
  48. }
  49. // TODO: Use resp.
  50. _ = resp
  51. }
  52. }
  53. func ExampleConfigClient_GetSink() {
  54. ctx := context.Background()
  55. c, err := logging.NewConfigClient(ctx)
  56. if err != nil {
  57. // TODO: Handle error.
  58. }
  59. req := &loggingpb.GetSinkRequest{
  60. // TODO: Fill request struct fields.
  61. }
  62. resp, err := c.GetSink(ctx, req)
  63. if err != nil {
  64. // TODO: Handle error.
  65. }
  66. // TODO: Use resp.
  67. _ = resp
  68. }
  69. func ExampleConfigClient_CreateSink() {
  70. ctx := context.Background()
  71. c, err := logging.NewConfigClient(ctx)
  72. if err != nil {
  73. // TODO: Handle error.
  74. }
  75. req := &loggingpb.CreateSinkRequest{
  76. // TODO: Fill request struct fields.
  77. }
  78. resp, err := c.CreateSink(ctx, req)
  79. if err != nil {
  80. // TODO: Handle error.
  81. }
  82. // TODO: Use resp.
  83. _ = resp
  84. }
  85. func ExampleConfigClient_UpdateSink() {
  86. ctx := context.Background()
  87. c, err := logging.NewConfigClient(ctx)
  88. if err != nil {
  89. // TODO: Handle error.
  90. }
  91. req := &loggingpb.UpdateSinkRequest{
  92. // TODO: Fill request struct fields.
  93. }
  94. resp, err := c.UpdateSink(ctx, req)
  95. if err != nil {
  96. // TODO: Handle error.
  97. }
  98. // TODO: Use resp.
  99. _ = resp
  100. }
  101. func ExampleConfigClient_DeleteSink() {
  102. ctx := context.Background()
  103. c, err := logging.NewConfigClient(ctx)
  104. if err != nil {
  105. // TODO: Handle error.
  106. }
  107. req := &loggingpb.DeleteSinkRequest{
  108. // TODO: Fill request struct fields.
  109. }
  110. err = c.DeleteSink(ctx, req)
  111. if err != nil {
  112. // TODO: Handle error.
  113. }
  114. }
  115. func ExampleConfigClient_ListExclusions() {
  116. ctx := context.Background()
  117. c, err := logging.NewConfigClient(ctx)
  118. if err != nil {
  119. // TODO: Handle error.
  120. }
  121. req := &loggingpb.ListExclusionsRequest{
  122. // TODO: Fill request struct fields.
  123. }
  124. it := c.ListExclusions(ctx, req)
  125. for {
  126. resp, err := it.Next()
  127. if err == iterator.Done {
  128. break
  129. }
  130. if err != nil {
  131. // TODO: Handle error.
  132. }
  133. // TODO: Use resp.
  134. _ = resp
  135. }
  136. }
  137. func ExampleConfigClient_GetExclusion() {
  138. ctx := context.Background()
  139. c, err := logging.NewConfigClient(ctx)
  140. if err != nil {
  141. // TODO: Handle error.
  142. }
  143. req := &loggingpb.GetExclusionRequest{
  144. // TODO: Fill request struct fields.
  145. }
  146. resp, err := c.GetExclusion(ctx, req)
  147. if err != nil {
  148. // TODO: Handle error.
  149. }
  150. // TODO: Use resp.
  151. _ = resp
  152. }
  153. func ExampleConfigClient_CreateExclusion() {
  154. ctx := context.Background()
  155. c, err := logging.NewConfigClient(ctx)
  156. if err != nil {
  157. // TODO: Handle error.
  158. }
  159. req := &loggingpb.CreateExclusionRequest{
  160. // TODO: Fill request struct fields.
  161. }
  162. resp, err := c.CreateExclusion(ctx, req)
  163. if err != nil {
  164. // TODO: Handle error.
  165. }
  166. // TODO: Use resp.
  167. _ = resp
  168. }
  169. func ExampleConfigClient_UpdateExclusion() {
  170. ctx := context.Background()
  171. c, err := logging.NewConfigClient(ctx)
  172. if err != nil {
  173. // TODO: Handle error.
  174. }
  175. req := &loggingpb.UpdateExclusionRequest{
  176. // TODO: Fill request struct fields.
  177. }
  178. resp, err := c.UpdateExclusion(ctx, req)
  179. if err != nil {
  180. // TODO: Handle error.
  181. }
  182. // TODO: Use resp.
  183. _ = resp
  184. }
  185. func ExampleConfigClient_DeleteExclusion() {
  186. ctx := context.Background()
  187. c, err := logging.NewConfigClient(ctx)
  188. if err != nil {
  189. // TODO: Handle error.
  190. }
  191. req := &loggingpb.DeleteExclusionRequest{
  192. // TODO: Fill request struct fields.
  193. }
  194. err = c.DeleteExclusion(ctx, req)
  195. if err != nil {
  196. // TODO: Handle error.
  197. }
  198. }