1// Copyright 2020 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 monitoring_test
18
19import (
20	"context"
21
22	monitoring "cloud.google.com/go/monitoring/apiv3"
23	"google.golang.org/api/iterator"
24	monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
25)
26
27func ExampleNewAlertPolicyClient() {
28	ctx := context.Background()
29	c, err := monitoring.NewAlertPolicyClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	// TODO: Use client.
34	_ = c
35}
36
37func ExampleAlertPolicyClient_ListAlertPolicies() {
38	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
39	// import "google.golang.org/api/iterator"
40
41	ctx := context.Background()
42	c, err := monitoring.NewAlertPolicyClient(ctx)
43	if err != nil {
44		// TODO: Handle error.
45	}
46
47	req := &monitoringpb.ListAlertPoliciesRequest{
48		// TODO: Fill request struct fields.
49	}
50	it := c.ListAlertPolicies(ctx, req)
51	for {
52		resp, err := it.Next()
53		if err == iterator.Done {
54			break
55		}
56		if err != nil {
57			// TODO: Handle error.
58		}
59		// TODO: Use resp.
60		_ = resp
61	}
62}
63
64func ExampleAlertPolicyClient_GetAlertPolicy() {
65	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
66
67	ctx := context.Background()
68	c, err := monitoring.NewAlertPolicyClient(ctx)
69	if err != nil {
70		// TODO: Handle error.
71	}
72
73	req := &monitoringpb.GetAlertPolicyRequest{
74		// TODO: Fill request struct fields.
75	}
76	resp, err := c.GetAlertPolicy(ctx, req)
77	if err != nil {
78		// TODO: Handle error.
79	}
80	// TODO: Use resp.
81	_ = resp
82}
83
84func ExampleAlertPolicyClient_CreateAlertPolicy() {
85	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
86
87	ctx := context.Background()
88	c, err := monitoring.NewAlertPolicyClient(ctx)
89	if err != nil {
90		// TODO: Handle error.
91	}
92
93	req := &monitoringpb.CreateAlertPolicyRequest{
94		// TODO: Fill request struct fields.
95	}
96	resp, err := c.CreateAlertPolicy(ctx, req)
97	if err != nil {
98		// TODO: Handle error.
99	}
100	// TODO: Use resp.
101	_ = resp
102}
103
104func ExampleAlertPolicyClient_DeleteAlertPolicy() {
105	ctx := context.Background()
106	c, err := monitoring.NewAlertPolicyClient(ctx)
107	if err != nil {
108		// TODO: Handle error.
109	}
110
111	req := &monitoringpb.DeleteAlertPolicyRequest{
112		// TODO: Fill request struct fields.
113	}
114	err = c.DeleteAlertPolicy(ctx, req)
115	if err != nil {
116		// TODO: Handle error.
117	}
118}
119
120func ExampleAlertPolicyClient_UpdateAlertPolicy() {
121	// import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
122
123	ctx := context.Background()
124	c, err := monitoring.NewAlertPolicyClient(ctx)
125	if err != nil {
126		// TODO: Handle error.
127	}
128
129	req := &monitoringpb.UpdateAlertPolicyRequest{
130		// TODO: Fill request struct fields.
131	}
132	resp, err := c.UpdateAlertPolicy(ctx, req)
133	if err != nil {
134		// TODO: Handle error.
135	}
136	// TODO: Use resp.
137	_ = resp
138}
139