Debian Codegraph @

osconfig/agentendpoint/apiv1beta/agent_endpoint_client_example_test.go

raw
1 // Copyright 2025 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
17 package agentendpoint_test
18
19 import (
20 "context"
21
22 agentendpoint "cloud.google.com/go/osconfig/agentendpoint/apiv1beta"
23 agentendpointpb "cloud.google.com/go/osconfig/agentendpoint/apiv1beta/agentendpointpb"
24 )
25
26 func ExampleNewClient() {
27 ctx := context.Background()
28 // This snippet has been automatically generated and should be regarded as a code template only.
29 // It will require modifications to work:
30 // - It may require correct/in-range values for request initialization.
31 // - It may require specifying regional endpoints when creating the service client as shown in:
32 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
33 c, err := agentendpoint.NewClient(ctx)
34 if err != nil {
35 // TODO: Handle error.
36 }
37 defer c.Close()
38
39 // TODO: Use client.
40 _ = c
41 }
42
43 func ExampleClient_LookupEffectiveGuestPolicy() {
44 ctx := context.Background()
45 // This snippet has been automatically generated and should be regarded as a code template only.
46 // It will require modifications to work:
47 // - It may require correct/in-range values for request initialization.
48 // - It may require specifying regional endpoints when creating the service client as shown in:
49 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
50 c, err := agentendpoint.NewClient(ctx)
51 if err != nil {
52 // TODO: Handle error.
53 }
54 defer c.Close()
55
56 req := &agentendpointpb.LookupEffectiveGuestPolicyRequest{
57 // TODO: Fill request struct fields.
58 // See https://pkg.go.dev/cloud.google.com/go/osconfig/agentendpoint/apiv1beta/agentendpointpb#LookupEffectiveGuestPolicyRequest.
59 }
60 resp, err := c.LookupEffectiveGuestPolicy(ctx, req)
61 if err != nil {
62 // TODO: Handle error.
63 }
64 // TODO: Use resp.
65 _ = resp
66 }
67
68 func ExampleClient_RegisterAgent() {
69 ctx := context.Background()
70 // This snippet has been automatically generated and should be regarded as a code template only.
71 // It will require modifications to work:
72 // - It may require correct/in-range values for request initialization.
73 // - It may require specifying regional endpoints when creating the service client as shown in:
74 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
75 c, err := agentendpoint.NewClient(ctx)
76 if err != nil {
77 // TODO: Handle error.
78 }
79 defer c.Close()
80
81 req := &agentendpointpb.RegisterAgentRequest{
82 // TODO: Fill request struct fields.
83 // See https://pkg.go.dev/cloud.google.com/go/osconfig/agentendpoint/apiv1beta/agentendpointpb#RegisterAgentRequest.
84 }
85 resp, err := c.RegisterAgent(ctx, req)
86 if err != nil {
87 // TODO: Handle error.
88 }
89 // TODO: Use resp.
90 _ = resp
91 }
92
93 func ExampleClient_ReportTaskComplete() {
94 ctx := context.Background()
95 // This snippet has been automatically generated and should be regarded as a code template only.
96 // It will require modifications to work:
97 // - It may require correct/in-range values for request initialization.
98 // - It may require specifying regional endpoints when creating the service client as shown in:
99 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
100 c, err := agentendpoint.NewClient(ctx)
101 if err != nil {
102 // TODO: Handle error.
103 }
104 defer c.Close()
105
106 req := &agentendpointpb.ReportTaskCompleteRequest{
107 // TODO: Fill request struct fields.
108 // See https://pkg.go.dev/cloud.google.com/go/osconfig/agentendpoint/apiv1beta/agentendpointpb#ReportTaskCompleteRequest.
109 }
110 resp, err := c.ReportTaskComplete(ctx, req)
111 if err != nil {
112 // TODO: Handle error.
113 }
114 // TODO: Use resp.
115 _ = resp
116 }
117
118 func ExampleClient_ReportTaskProgress() {
119 ctx := context.Background()
120 // This snippet has been automatically generated and should be regarded as a code template only.
121 // It will require modifications to work:
122 // - It may require correct/in-range values for request initialization.
123 // - It may require specifying regional endpoints when creating the service client as shown in:
124 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
125 c, err := agentendpoint.NewClient(ctx)
126 if err != nil {
127 // TODO: Handle error.
128 }
129 defer c.Close()
130
131 req := &agentendpointpb.ReportTaskProgressRequest{
132 // TODO: Fill request struct fields.
133 // See https://pkg.go.dev/cloud.google.com/go/osconfig/agentendpoint/apiv1beta/agentendpointpb#ReportTaskProgressRequest.
134 }
135 resp, err := c.ReportTaskProgress(ctx, req)
136 if err != nil {
137 // TODO: Handle error.
138 }
139 // TODO: Use resp.
140 _ = resp
141 }
142
143 func ExampleClient_StartNextTask() {
144 ctx := context.Background()
145 // This snippet has been automatically generated and should be regarded as a code template only.
146 // It will require modifications to work:
147 // - It may require correct/in-range values for request initialization.
148 // - It may require specifying regional endpoints when creating the service client as shown in:
149 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
150 c, err := agentendpoint.NewClient(ctx)
151 if err != nil {
152 // TODO: Handle error.
153 }
154 defer c.Close()
155
156 req := &agentendpointpb.StartNextTaskRequest{
157 // TODO: Fill request struct fields.
158 // See https://pkg.go.dev/cloud.google.com/go/osconfig/agentendpoint/apiv1beta/agentendpointpb#StartNextTaskRequest.
159 }
160 resp, err := c.StartNextTask(ctx, req)
161 if err != nil {
162 // TODO: Handle error.
163 }
164 // TODO: Use resp.
165 _ = resp
166 }