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.
 
 
 

161 lines
3.5 KiB

  1. // Copyright 2018 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. // AUTO-GENERATED CODE. DO NOT EDIT.
  15. package dataproc_test
  16. import (
  17. "cloud.google.com/go/dataproc/apiv1"
  18. "golang.org/x/net/context"
  19. "google.golang.org/api/iterator"
  20. dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
  21. )
  22. func ExampleNewClusterControllerClient() {
  23. ctx := context.Background()
  24. c, err := dataproc.NewClusterControllerClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleClusterControllerClient_CreateCluster() {
  32. ctx := context.Background()
  33. c, err := dataproc.NewClusterControllerClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &dataprocpb.CreateClusterRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. op, err := c.CreateCluster(ctx, req)
  41. if err != nil {
  42. // TODO: Handle error.
  43. }
  44. resp, err := op.Wait(ctx)
  45. if err != nil {
  46. // TODO: Handle error.
  47. }
  48. // TODO: Use resp.
  49. _ = resp
  50. }
  51. func ExampleClusterControllerClient_UpdateCluster() {
  52. ctx := context.Background()
  53. c, err := dataproc.NewClusterControllerClient(ctx)
  54. if err != nil {
  55. // TODO: Handle error.
  56. }
  57. req := &dataprocpb.UpdateClusterRequest{
  58. // TODO: Fill request struct fields.
  59. }
  60. op, err := c.UpdateCluster(ctx, req)
  61. if err != nil {
  62. // TODO: Handle error.
  63. }
  64. resp, err := op.Wait(ctx)
  65. if err != nil {
  66. // TODO: Handle error.
  67. }
  68. // TODO: Use resp.
  69. _ = resp
  70. }
  71. func ExampleClusterControllerClient_DeleteCluster() {
  72. ctx := context.Background()
  73. c, err := dataproc.NewClusterControllerClient(ctx)
  74. if err != nil {
  75. // TODO: Handle error.
  76. }
  77. req := &dataprocpb.DeleteClusterRequest{
  78. // TODO: Fill request struct fields.
  79. }
  80. op, err := c.DeleteCluster(ctx, req)
  81. if err != nil {
  82. // TODO: Handle error.
  83. }
  84. err = op.Wait(ctx)
  85. // TODO: Handle error.
  86. }
  87. func ExampleClusterControllerClient_GetCluster() {
  88. ctx := context.Background()
  89. c, err := dataproc.NewClusterControllerClient(ctx)
  90. if err != nil {
  91. // TODO: Handle error.
  92. }
  93. req := &dataprocpb.GetClusterRequest{
  94. // TODO: Fill request struct fields.
  95. }
  96. resp, err := c.GetCluster(ctx, req)
  97. if err != nil {
  98. // TODO: Handle error.
  99. }
  100. // TODO: Use resp.
  101. _ = resp
  102. }
  103. func ExampleClusterControllerClient_ListClusters() {
  104. ctx := context.Background()
  105. c, err := dataproc.NewClusterControllerClient(ctx)
  106. if err != nil {
  107. // TODO: Handle error.
  108. }
  109. req := &dataprocpb.ListClustersRequest{
  110. // TODO: Fill request struct fields.
  111. }
  112. it := c.ListClusters(ctx, req)
  113. for {
  114. resp, err := it.Next()
  115. if err == iterator.Done {
  116. break
  117. }
  118. if err != nil {
  119. // TODO: Handle error.
  120. }
  121. // TODO: Use resp.
  122. _ = resp
  123. }
  124. }
  125. func ExampleClusterControllerClient_DiagnoseCluster() {
  126. ctx := context.Background()
  127. c, err := dataproc.NewClusterControllerClient(ctx)
  128. if err != nil {
  129. // TODO: Handle error.
  130. }
  131. req := &dataprocpb.DiagnoseClusterRequest{
  132. // TODO: Fill request struct fields.
  133. }
  134. op, err := c.DiagnoseCluster(ctx, req)
  135. if err != nil {
  136. // TODO: Handle error.
  137. }
  138. err = op.Wait(ctx)
  139. // TODO: Handle error.
  140. }