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.
 
 
 

168 lines
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 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 ExampleNewWorkflowTemplateClient() {
  23. ctx := context.Background()
  24. c, err := dataproc.NewWorkflowTemplateClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleWorkflowTemplateClient_CreateWorkflowTemplate() {
  32. ctx := context.Background()
  33. c, err := dataproc.NewWorkflowTemplateClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &dataprocpb.CreateWorkflowTemplateRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. resp, err := c.CreateWorkflowTemplate(ctx, req)
  41. if err != nil {
  42. // TODO: Handle error.
  43. }
  44. // TODO: Use resp.
  45. _ = resp
  46. }
  47. func ExampleWorkflowTemplateClient_GetWorkflowTemplate() {
  48. ctx := context.Background()
  49. c, err := dataproc.NewWorkflowTemplateClient(ctx)
  50. if err != nil {
  51. // TODO: Handle error.
  52. }
  53. req := &dataprocpb.GetWorkflowTemplateRequest{
  54. // TODO: Fill request struct fields.
  55. }
  56. resp, err := c.GetWorkflowTemplate(ctx, req)
  57. if err != nil {
  58. // TODO: Handle error.
  59. }
  60. // TODO: Use resp.
  61. _ = resp
  62. }
  63. func ExampleWorkflowTemplateClient_InstantiateWorkflowTemplate() {
  64. ctx := context.Background()
  65. c, err := dataproc.NewWorkflowTemplateClient(ctx)
  66. if err != nil {
  67. // TODO: Handle error.
  68. }
  69. req := &dataprocpb.InstantiateWorkflowTemplateRequest{
  70. // TODO: Fill request struct fields.
  71. }
  72. op, err := c.InstantiateWorkflowTemplate(ctx, req)
  73. if err != nil {
  74. // TODO: Handle error.
  75. }
  76. err = op.Wait(ctx)
  77. // TODO: Handle error.
  78. }
  79. func ExampleWorkflowTemplateClient_InstantiateInlineWorkflowTemplate() {
  80. ctx := context.Background()
  81. c, err := dataproc.NewWorkflowTemplateClient(ctx)
  82. if err != nil {
  83. // TODO: Handle error.
  84. }
  85. req := &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
  86. // TODO: Fill request struct fields.
  87. }
  88. op, err := c.InstantiateInlineWorkflowTemplate(ctx, req)
  89. if err != nil {
  90. // TODO: Handle error.
  91. }
  92. err = op.Wait(ctx)
  93. // TODO: Handle error.
  94. }
  95. func ExampleWorkflowTemplateClient_UpdateWorkflowTemplate() {
  96. ctx := context.Background()
  97. c, err := dataproc.NewWorkflowTemplateClient(ctx)
  98. if err != nil {
  99. // TODO: Handle error.
  100. }
  101. req := &dataprocpb.UpdateWorkflowTemplateRequest{
  102. // TODO: Fill request struct fields.
  103. }
  104. resp, err := c.UpdateWorkflowTemplate(ctx, req)
  105. if err != nil {
  106. // TODO: Handle error.
  107. }
  108. // TODO: Use resp.
  109. _ = resp
  110. }
  111. func ExampleWorkflowTemplateClient_ListWorkflowTemplates() {
  112. ctx := context.Background()
  113. c, err := dataproc.NewWorkflowTemplateClient(ctx)
  114. if err != nil {
  115. // TODO: Handle error.
  116. }
  117. req := &dataprocpb.ListWorkflowTemplatesRequest{
  118. // TODO: Fill request struct fields.
  119. }
  120. it := c.ListWorkflowTemplates(ctx, req)
  121. for {
  122. resp, err := it.Next()
  123. if err == iterator.Done {
  124. break
  125. }
  126. if err != nil {
  127. // TODO: Handle error.
  128. }
  129. // TODO: Use resp.
  130. _ = resp
  131. }
  132. }
  133. func ExampleWorkflowTemplateClient_DeleteWorkflowTemplate() {
  134. ctx := context.Background()
  135. c, err := dataproc.NewWorkflowTemplateClient(ctx)
  136. if err != nil {
  137. // TODO: Handle error.
  138. }
  139. req := &dataprocpb.DeleteWorkflowTemplateRequest{
  140. // TODO: Fill request struct fields.
  141. }
  142. err = c.DeleteWorkflowTemplate(ctx, req)
  143. if err != nil {
  144. // TODO: Handle error.
  145. }
  146. }