Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

142 lignes
2.9 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 ExampleNewClient() {
  23. ctx := context.Background()
  24. c, err := logging.NewClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleClient_DeleteLog() {
  32. ctx := context.Background()
  33. c, err := logging.NewClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &loggingpb.DeleteLogRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. err = c.DeleteLog(ctx, req)
  41. if err != nil {
  42. // TODO: Handle error.
  43. }
  44. }
  45. func ExampleClient_WriteLogEntries() {
  46. ctx := context.Background()
  47. c, err := logging.NewClient(ctx)
  48. if err != nil {
  49. // TODO: Handle error.
  50. }
  51. req := &loggingpb.WriteLogEntriesRequest{
  52. // TODO: Fill request struct fields.
  53. }
  54. resp, err := c.WriteLogEntries(ctx, req)
  55. if err != nil {
  56. // TODO: Handle error.
  57. }
  58. // TODO: Use resp.
  59. _ = resp
  60. }
  61. func ExampleClient_ListLogEntries() {
  62. ctx := context.Background()
  63. c, err := logging.NewClient(ctx)
  64. if err != nil {
  65. // TODO: Handle error.
  66. }
  67. req := &loggingpb.ListLogEntriesRequest{
  68. // TODO: Fill request struct fields.
  69. }
  70. it := c.ListLogEntries(ctx, req)
  71. for {
  72. resp, err := it.Next()
  73. if err == iterator.Done {
  74. break
  75. }
  76. if err != nil {
  77. // TODO: Handle error.
  78. }
  79. // TODO: Use resp.
  80. _ = resp
  81. }
  82. }
  83. func ExampleClient_ListMonitoredResourceDescriptors() {
  84. ctx := context.Background()
  85. c, err := logging.NewClient(ctx)
  86. if err != nil {
  87. // TODO: Handle error.
  88. }
  89. req := &loggingpb.ListMonitoredResourceDescriptorsRequest{
  90. // TODO: Fill request struct fields.
  91. }
  92. it := c.ListMonitoredResourceDescriptors(ctx, req)
  93. for {
  94. resp, err := it.Next()
  95. if err == iterator.Done {
  96. break
  97. }
  98. if err != nil {
  99. // TODO: Handle error.
  100. }
  101. // TODO: Use resp.
  102. _ = resp
  103. }
  104. }
  105. func ExampleClient_ListLogs() {
  106. ctx := context.Background()
  107. c, err := logging.NewClient(ctx)
  108. if err != nil {
  109. // TODO: Handle error.
  110. }
  111. req := &loggingpb.ListLogsRequest{
  112. // TODO: Fill request struct fields.
  113. }
  114. it := c.ListLogs(ctx, req)
  115. for {
  116. resp, err := it.Next()
  117. if err == iterator.Done {
  118. break
  119. }
  120. if err != nil {
  121. // TODO: Handle error.
  122. }
  123. // TODO: Use resp.
  124. _ = resp
  125. }
  126. }