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 ExampleNewAutoscalingPolicyClient() {
28	ctx := context.Background()
29	c, err := dataproc.NewAutoscalingPolicyClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	// TODO: Use client.
34	_ = c
35}
36
37func ExampleAutoscalingPolicyClient_CreateAutoscalingPolicy() {
38	// import dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
39
40	ctx := context.Background()
41	c, err := dataproc.NewAutoscalingPolicyClient(ctx)
42	if err != nil {
43		// TODO: Handle error.
44	}
45
46	req := &dataprocpb.CreateAutoscalingPolicyRequest{
47		// TODO: Fill request struct fields.
48	}
49	resp, err := c.CreateAutoscalingPolicy(ctx, req)
50	if err != nil {
51		// TODO: Handle error.
52	}
53	// TODO: Use resp.
54	_ = resp
55}
56
57func ExampleAutoscalingPolicyClient_UpdateAutoscalingPolicy() {
58	// import dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
59
60	ctx := context.Background()
61	c, err := dataproc.NewAutoscalingPolicyClient(ctx)
62	if err != nil {
63		// TODO: Handle error.
64	}
65
66	req := &dataprocpb.UpdateAutoscalingPolicyRequest{
67		// TODO: Fill request struct fields.
68	}
69	resp, err := c.UpdateAutoscalingPolicy(ctx, req)
70	if err != nil {
71		// TODO: Handle error.
72	}
73	// TODO: Use resp.
74	_ = resp
75}
76
77func ExampleAutoscalingPolicyClient_GetAutoscalingPolicy() {
78	// import dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
79
80	ctx := context.Background()
81	c, err := dataproc.NewAutoscalingPolicyClient(ctx)
82	if err != nil {
83		// TODO: Handle error.
84	}
85
86	req := &dataprocpb.GetAutoscalingPolicyRequest{
87		// TODO: Fill request struct fields.
88	}
89	resp, err := c.GetAutoscalingPolicy(ctx, req)
90	if err != nil {
91		// TODO: Handle error.
92	}
93	// TODO: Use resp.
94	_ = resp
95}
96
97func ExampleAutoscalingPolicyClient_ListAutoscalingPolicies() {
98	// import dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
99	// import "google.golang.org/api/iterator"
100
101	ctx := context.Background()
102	c, err := dataproc.NewAutoscalingPolicyClient(ctx)
103	if err != nil {
104		// TODO: Handle error.
105	}
106
107	req := &dataprocpb.ListAutoscalingPoliciesRequest{
108		// TODO: Fill request struct fields.
109	}
110	it := c.ListAutoscalingPolicies(ctx, req)
111	for {
112		resp, err := it.Next()
113		if err == iterator.Done {
114			break
115		}
116		if err != nil {
117			// TODO: Handle error.
118		}
119		// TODO: Use resp.
120		_ = resp
121	}
122}
123
124func ExampleAutoscalingPolicyClient_DeleteAutoscalingPolicy() {
125	ctx := context.Background()
126	c, err := dataproc.NewAutoscalingPolicyClient(ctx)
127	if err != nil {
128		// TODO: Handle error.
129	}
130
131	req := &dataprocpb.DeleteAutoscalingPolicyRequest{
132		// TODO: Fill request struct fields.
133	}
134	err = c.DeleteAutoscalingPolicy(ctx, req)
135	if err != nil {
136		// TODO: Handle error.
137	}
138}
139