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.
 
 
 

148 lines
3.2 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 dataproc_test
  16. import (
  17. "context"
  18. dataproc "cloud.google.com/go/dataproc/apiv1"
  19. "google.golang.org/api/iterator"
  20. dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
  21. )
  22. func ExampleNewJobControllerClient() {
  23. ctx := context.Background()
  24. c, err := dataproc.NewJobControllerClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleJobControllerClient_SubmitJob() {
  32. ctx := context.Background()
  33. c, err := dataproc.NewJobControllerClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &dataprocpb.SubmitJobRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. resp, err := c.SubmitJob(ctx, req)
  41. if err != nil {
  42. // TODO: Handle error.
  43. }
  44. // TODO: Use resp.
  45. _ = resp
  46. }
  47. func ExampleJobControllerClient_GetJob() {
  48. ctx := context.Background()
  49. c, err := dataproc.NewJobControllerClient(ctx)
  50. if err != nil {
  51. // TODO: Handle error.
  52. }
  53. req := &dataprocpb.GetJobRequest{
  54. // TODO: Fill request struct fields.
  55. }
  56. resp, err := c.GetJob(ctx, req)
  57. if err != nil {
  58. // TODO: Handle error.
  59. }
  60. // TODO: Use resp.
  61. _ = resp
  62. }
  63. func ExampleJobControllerClient_ListJobs() {
  64. ctx := context.Background()
  65. c, err := dataproc.NewJobControllerClient(ctx)
  66. if err != nil {
  67. // TODO: Handle error.
  68. }
  69. req := &dataprocpb.ListJobsRequest{
  70. // TODO: Fill request struct fields.
  71. }
  72. it := c.ListJobs(ctx, req)
  73. for {
  74. resp, err := it.Next()
  75. if err == iterator.Done {
  76. break
  77. }
  78. if err != nil {
  79. // TODO: Handle error.
  80. }
  81. // TODO: Use resp.
  82. _ = resp
  83. }
  84. }
  85. func ExampleJobControllerClient_UpdateJob() {
  86. ctx := context.Background()
  87. c, err := dataproc.NewJobControllerClient(ctx)
  88. if err != nil {
  89. // TODO: Handle error.
  90. }
  91. req := &dataprocpb.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 ExampleJobControllerClient_CancelJob() {
  102. ctx := context.Background()
  103. c, err := dataproc.NewJobControllerClient(ctx)
  104. if err != nil {
  105. // TODO: Handle error.
  106. }
  107. req := &dataprocpb.CancelJobRequest{
  108. // TODO: Fill request struct fields.
  109. }
  110. resp, err := c.CancelJob(ctx, req)
  111. if err != nil {
  112. // TODO: Handle error.
  113. }
  114. // TODO: Use resp.
  115. _ = resp
  116. }
  117. func ExampleJobControllerClient_DeleteJob() {
  118. ctx := context.Background()
  119. c, err := dataproc.NewJobControllerClient(ctx)
  120. if err != nil {
  121. // TODO: Handle error.
  122. }
  123. req := &dataprocpb.DeleteJobRequest{
  124. // TODO: Fill request struct fields.
  125. }
  126. err = c.DeleteJob(ctx, req)
  127. if err != nil {
  128. // TODO: Handle error.
  129. }
  130. }