1// Copyright 2021 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 15// Code generated by protoc-gen-go_gapic. DO NOT EDIT. 16 17package dataproc_test 18 19import ( 20 "context" 21 22 dataproc "cloud.google.com/go/dataproc/apiv1" 23 "google.golang.org/api/iterator" 24 dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" 25) 26 27func ExampleNewWorkflowTemplateClient() { 28 ctx := context.Background() 29 c, err := dataproc.NewWorkflowTemplateClient(ctx) 30 if err != nil { 31 // TODO: Handle error. 32 } 33 defer c.Close() 34 35 // TODO: Use client. 36 _ = c 37} 38 39func ExampleWorkflowTemplateClient_CreateWorkflowTemplate() { 40 ctx := context.Background() 41 c, err := dataproc.NewWorkflowTemplateClient(ctx) 42 if err != nil { 43 // TODO: Handle error. 44 } 45 defer c.Close() 46 47 req := &dataprocpb.CreateWorkflowTemplateRequest{ 48 // TODO: Fill request struct fields. 49 } 50 resp, err := c.CreateWorkflowTemplate(ctx, req) 51 if err != nil { 52 // TODO: Handle error. 53 } 54 // TODO: Use resp. 55 _ = resp 56} 57 58func ExampleWorkflowTemplateClient_GetWorkflowTemplate() { 59 ctx := context.Background() 60 c, err := dataproc.NewWorkflowTemplateClient(ctx) 61 if err != nil { 62 // TODO: Handle error. 63 } 64 defer c.Close() 65 66 req := &dataprocpb.GetWorkflowTemplateRequest{ 67 // TODO: Fill request struct fields. 68 } 69 resp, err := c.GetWorkflowTemplate(ctx, req) 70 if err != nil { 71 // TODO: Handle error. 72 } 73 // TODO: Use resp. 74 _ = resp 75} 76 77func ExampleWorkflowTemplateClient_InstantiateWorkflowTemplate() { 78 ctx := context.Background() 79 c, err := dataproc.NewWorkflowTemplateClient(ctx) 80 if err != nil { 81 // TODO: Handle error. 82 } 83 defer c.Close() 84 85 req := &dataprocpb.InstantiateWorkflowTemplateRequest{ 86 // TODO: Fill request struct fields. 87 } 88 op, err := c.InstantiateWorkflowTemplate(ctx, req) 89 if err != nil { 90 // TODO: Handle error. 91 } 92 93 err = op.Wait(ctx) 94 if err != nil { 95 // TODO: Handle error. 96 } 97} 98 99func ExampleWorkflowTemplateClient_InstantiateInlineWorkflowTemplate() { 100 ctx := context.Background() 101 c, err := dataproc.NewWorkflowTemplateClient(ctx) 102 if err != nil { 103 // TODO: Handle error. 104 } 105 defer c.Close() 106 107 req := &dataprocpb.InstantiateInlineWorkflowTemplateRequest{ 108 // TODO: Fill request struct fields. 109 } 110 op, err := c.InstantiateInlineWorkflowTemplate(ctx, req) 111 if err != nil { 112 // TODO: Handle error. 113 } 114 115 err = op.Wait(ctx) 116 if err != nil { 117 // TODO: Handle error. 118 } 119} 120 121func ExampleWorkflowTemplateClient_UpdateWorkflowTemplate() { 122 ctx := context.Background() 123 c, err := dataproc.NewWorkflowTemplateClient(ctx) 124 if err != nil { 125 // TODO: Handle error. 126 } 127 defer c.Close() 128 129 req := &dataprocpb.UpdateWorkflowTemplateRequest{ 130 // TODO: Fill request struct fields. 131 } 132 resp, err := c.UpdateWorkflowTemplate(ctx, req) 133 if err != nil { 134 // TODO: Handle error. 135 } 136 // TODO: Use resp. 137 _ = resp 138} 139 140func ExampleWorkflowTemplateClient_ListWorkflowTemplates() { 141 ctx := context.Background() 142 c, err := dataproc.NewWorkflowTemplateClient(ctx) 143 if err != nil { 144 // TODO: Handle error. 145 } 146 defer c.Close() 147 148 req := &dataprocpb.ListWorkflowTemplatesRequest{ 149 // TODO: Fill request struct fields. 150 } 151 it := c.ListWorkflowTemplates(ctx, req) 152 for { 153 resp, err := it.Next() 154 if err == iterator.Done { 155 break 156 } 157 if err != nil { 158 // TODO: Handle error. 159 } 160 // TODO: Use resp. 161 _ = resp 162 } 163} 164 165func ExampleWorkflowTemplateClient_DeleteWorkflowTemplate() { 166 ctx := context.Background() 167 c, err := dataproc.NewWorkflowTemplateClient(ctx) 168 if err != nil { 169 // TODO: Handle error. 170 } 171 defer c.Close() 172 173 req := &dataprocpb.DeleteWorkflowTemplateRequest{ 174 // TODO: Fill request struct fields. 175 } 176 err = c.DeleteWorkflowTemplate(ctx, req) 177 if err != nil { 178 // TODO: Handle error. 179 } 180} 181