Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

184 rindas
3.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 scheduler_test
  16. import (
  17. "context"
  18. scheduler "cloud.google.com/go/scheduler/apiv1"
  19. "google.golang.org/api/iterator"
  20. schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1"
  21. )
  22. func ExampleNewCloudSchedulerClient() {
  23. ctx := context.Background()
  24. c, err := scheduler.NewCloudSchedulerClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleCloudSchedulerClient_ListJobs() {
  32. ctx := context.Background()
  33. c, err := scheduler.NewCloudSchedulerClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &schedulerpb.ListJobsRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. it := c.ListJobs(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 ExampleCloudSchedulerClient_GetJob() {
  54. ctx := context.Background()
  55. c, err := scheduler.NewCloudSchedulerClient(ctx)
  56. if err != nil {
  57. // TODO: Handle error.
  58. }
  59. req := &schedulerpb.GetJobRequest{
  60. // TODO: Fill request struct fields.
  61. }
  62. resp, err := c.GetJob(ctx, req)
  63. if err != nil {
  64. // TODO: Handle error.
  65. }
  66. // TODO: Use resp.
  67. _ = resp
  68. }
  69. func ExampleCloudSchedulerClient_CreateJob() {
  70. ctx := context.Background()
  71. c, err := scheduler.NewCloudSchedulerClient(ctx)
  72. if err != nil {
  73. // TODO: Handle error.
  74. }
  75. req := &schedulerpb.CreateJobRequest{
  76. // TODO: Fill request struct fields.
  77. }
  78. resp, err := c.CreateJob(ctx, req)
  79. if err != nil {
  80. // TODO: Handle error.
  81. }
  82. // TODO: Use resp.
  83. _ = resp
  84. }
  85. func ExampleCloudSchedulerClient_UpdateJob() {
  86. ctx := context.Background()
  87. c, err := scheduler.NewCloudSchedulerClient(ctx)
  88. if err != nil {
  89. // TODO: Handle error.
  90. }
  91. req := &schedulerpb.UpdateJobRequest{
  92. // TODO: Fill request struct fields.
  93. }
  94. resp, err := c.UpdateJob(ctx, req)
  95. if err != nil {
  96. // TODO: Handle error.
  97. }
  98. // TODO: Use resp.
  99. _ = resp
  100. }
  101. func ExampleCloudSchedulerClient_DeleteJob() {
  102. ctx := context.Background()
  103. c, err := scheduler.NewCloudSchedulerClient(ctx)
  104. if err != nil {
  105. // TODO: Handle error.
  106. }
  107. req := &schedulerpb.DeleteJobRequest{
  108. // TODO: Fill request struct fields.
  109. }
  110. err = c.DeleteJob(ctx, req)
  111. if err != nil {
  112. // TODO: Handle error.
  113. }
  114. }
  115. func ExampleCloudSchedulerClient_PauseJob() {
  116. ctx := context.Background()
  117. c, err := scheduler.NewCloudSchedulerClient(ctx)
  118. if err != nil {
  119. // TODO: Handle error.
  120. }
  121. req := &schedulerpb.PauseJobRequest{
  122. // TODO: Fill request struct fields.
  123. }
  124. resp, err := c.PauseJob(ctx, req)
  125. if err != nil {
  126. // TODO: Handle error.
  127. }
  128. // TODO: Use resp.
  129. _ = resp
  130. }
  131. func ExampleCloudSchedulerClient_ResumeJob() {
  132. ctx := context.Background()
  133. c, err := scheduler.NewCloudSchedulerClient(ctx)
  134. if err != nil {
  135. // TODO: Handle error.
  136. }
  137. req := &schedulerpb.ResumeJobRequest{
  138. // TODO: Fill request struct fields.
  139. }
  140. resp, err := c.ResumeJob(ctx, req)
  141. if err != nil {
  142. // TODO: Handle error.
  143. }
  144. // TODO: Use resp.
  145. _ = resp
  146. }
  147. func ExampleCloudSchedulerClient_RunJob() {
  148. ctx := context.Background()
  149. c, err := scheduler.NewCloudSchedulerClient(ctx)
  150. if err != nil {
  151. // TODO: Handle error.
  152. }
  153. req := &schedulerpb.RunJobRequest{
  154. // TODO: Fill request struct fields.
  155. }
  156. resp, err := c.RunJob(ctx, req)
  157. if err != nil {
  158. // TODO: Handle error.
  159. }
  160. // TODO: Use resp.
  161. _ = resp
  162. }