1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 package acmedns
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71 )
72
73
74
75 var _ = bytes.NewBuffer
76 var _ = strconv.Itoa
77 var _ = fmt.Sprintf
78 var _ = json.NewDecoder
79 var _ = io.Copy
80 var _ = url.Parse
81 var _ = gensupport.MarshalJSON
82 var _ = googleapi.Version
83 var _ = errors.New
84 var _ = strings.Replace
85 var _ = context.Canceled
86 var _ = internaloption.WithDefaultEndpoint
87 var _ = internal.Version
88
89 const apiId = "acmedns:v1"
90 const apiName = "acmedns"
91 const apiVersion = "v1"
92 const basePath = "https://acmedns.googleapis.com/"
93 const basePathTemplate = "https://acmedns.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://acmedns.mtls.googleapis.com/"
95
96
97 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
98 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
99 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
100 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
101 opts = append(opts, internaloption.EnableNewAuthLibrary())
102 client, endpoint, err := htransport.NewClient(ctx, opts...)
103 if err != nil {
104 return nil, err
105 }
106 s, err := New(client)
107 if err != nil {
108 return nil, err
109 }
110 if endpoint != "" {
111 s.BasePath = endpoint
112 }
113 return s, nil
114 }
115
116
117
118
119
120
121 func New(client *http.Client) (*Service, error) {
122 if client == nil {
123 return nil, errors.New("client is nil")
124 }
125 s := &Service{client: client, BasePath: basePath}
126 s.AcmeChallengeSets = NewAcmeChallengeSetsService(s)
127 return s, nil
128 }
129
130 type Service struct {
131 client *http.Client
132 BasePath string
133 UserAgent string
134
135 AcmeChallengeSets *AcmeChallengeSetsService
136 }
137
138 func (s *Service) userAgent() string {
139 if s.UserAgent == "" {
140 return googleapi.UserAgent
141 }
142 return googleapi.UserAgent + " " + s.UserAgent
143 }
144
145 func NewAcmeChallengeSetsService(s *Service) *AcmeChallengeSetsService {
146 rs := &AcmeChallengeSetsService{s: s}
147 return rs
148 }
149
150 type AcmeChallengeSetsService struct {
151 s *Service
152 }
153
154
155
156 type AcmeChallengeSet struct {
157
158
159 Record []*AcmeTxtRecord `json:"record,omitempty"`
160
161
162 googleapi.ServerResponse `json:"-"`
163
164
165
166
167
168 ForceSendFields []string `json:"-"`
169
170
171
172
173 NullFields []string `json:"-"`
174 }
175
176 func (s *AcmeChallengeSet) MarshalJSON() ([]byte, error) {
177 type NoMethod AcmeChallengeSet
178 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
179 }
180
181
182
183 type AcmeTxtRecord struct {
184
185
186 Digest string `json:"digest,omitempty"`
187
188
189
190 Fqdn string `json:"fqdn,omitempty"`
191
192
193 UpdateTime string `json:"updateTime,omitempty"`
194
195
196
197
198
199 ForceSendFields []string `json:"-"`
200
201
202
203
204 NullFields []string `json:"-"`
205 }
206
207 func (s *AcmeTxtRecord) MarshalJSON() ([]byte, error) {
208 type NoMethod AcmeTxtRecord
209 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
210 }
211
212
213
214
215
216
217
218
219
220
221 type RotateChallengesRequest struct {
222
223
224
225 AccessToken string `json:"accessToken,omitempty"`
226
227
228 KeepExpiredRecords bool `json:"keepExpiredRecords,omitempty"`
229
230
231 RecordsToAdd []*AcmeTxtRecord `json:"recordsToAdd,omitempty"`
232
233 RecordsToRemove []*AcmeTxtRecord `json:"recordsToRemove,omitempty"`
234
235
236
237
238
239 ForceSendFields []string `json:"-"`
240
241
242
243
244 NullFields []string `json:"-"`
245 }
246
247 func (s *RotateChallengesRequest) MarshalJSON() ([]byte, error) {
248 type NoMethod RotateChallengesRequest
249 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
250 }
251
252 type AcmeChallengeSetsGetCall struct {
253 s *Service
254 rootDomain string
255 urlParams_ gensupport.URLParams
256 ifNoneMatch_ string
257 ctx_ context.Context
258 header_ http.Header
259 }
260
261
262
263
264
265
266
267 func (r *AcmeChallengeSetsService) Get(rootDomain string) *AcmeChallengeSetsGetCall {
268 c := &AcmeChallengeSetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
269 c.rootDomain = rootDomain
270 return c
271 }
272
273
274
275
276 func (c *AcmeChallengeSetsGetCall) Fields(s ...googleapi.Field) *AcmeChallengeSetsGetCall {
277 c.urlParams_.Set("fields", googleapi.CombineFields(s))
278 return c
279 }
280
281
282
283
284 func (c *AcmeChallengeSetsGetCall) IfNoneMatch(entityTag string) *AcmeChallengeSetsGetCall {
285 c.ifNoneMatch_ = entityTag
286 return c
287 }
288
289
290 func (c *AcmeChallengeSetsGetCall) Context(ctx context.Context) *AcmeChallengeSetsGetCall {
291 c.ctx_ = ctx
292 return c
293 }
294
295
296
297 func (c *AcmeChallengeSetsGetCall) Header() http.Header {
298 if c.header_ == nil {
299 c.header_ = make(http.Header)
300 }
301 return c.header_
302 }
303
304 func (c *AcmeChallengeSetsGetCall) doRequest(alt string) (*http.Response, error) {
305 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
306 if c.ifNoneMatch_ != "" {
307 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
308 }
309 var body io.Reader = nil
310 c.urlParams_.Set("alt", alt)
311 c.urlParams_.Set("prettyPrint", "false")
312 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/acmeChallengeSets/{rootDomain}")
313 urls += "?" + c.urlParams_.Encode()
314 req, err := http.NewRequest("GET", urls, body)
315 if err != nil {
316 return nil, err
317 }
318 req.Header = reqHeaders
319 googleapi.Expand(req.URL, map[string]string{
320 "rootDomain": c.rootDomain,
321 })
322 return gensupport.SendRequest(c.ctx_, c.s.client, req)
323 }
324
325
326
327
328
329
330
331 func (c *AcmeChallengeSetsGetCall) Do(opts ...googleapi.CallOption) (*AcmeChallengeSet, error) {
332 gensupport.SetOptions(c.urlParams_, opts...)
333 res, err := c.doRequest("json")
334 if res != nil && res.StatusCode == http.StatusNotModified {
335 if res.Body != nil {
336 res.Body.Close()
337 }
338 return nil, gensupport.WrapError(&googleapi.Error{
339 Code: res.StatusCode,
340 Header: res.Header,
341 })
342 }
343 if err != nil {
344 return nil, err
345 }
346 defer googleapi.CloseBody(res)
347 if err := googleapi.CheckResponse(res); err != nil {
348 return nil, gensupport.WrapError(err)
349 }
350 ret := &AcmeChallengeSet{
351 ServerResponse: googleapi.ServerResponse{
352 Header: res.Header,
353 HTTPStatusCode: res.StatusCode,
354 },
355 }
356 target := &ret
357 if err := gensupport.DecodeResponse(target, res); err != nil {
358 return nil, err
359 }
360 return ret, nil
361 }
362
363 type AcmeChallengeSetsRotateChallengesCall struct {
364 s *Service
365 rootDomain string
366 rotatechallengesrequest *RotateChallengesRequest
367 urlParams_ gensupport.URLParams
368 ctx_ context.Context
369 header_ http.Header
370 }
371
372
373
374
375
376
377
378
379 func (r *AcmeChallengeSetsService) RotateChallenges(rootDomain string, rotatechallengesrequest *RotateChallengesRequest) *AcmeChallengeSetsRotateChallengesCall {
380 c := &AcmeChallengeSetsRotateChallengesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
381 c.rootDomain = rootDomain
382 c.rotatechallengesrequest = rotatechallengesrequest
383 return c
384 }
385
386
387
388
389 func (c *AcmeChallengeSetsRotateChallengesCall) Fields(s ...googleapi.Field) *AcmeChallengeSetsRotateChallengesCall {
390 c.urlParams_.Set("fields", googleapi.CombineFields(s))
391 return c
392 }
393
394
395 func (c *AcmeChallengeSetsRotateChallengesCall) Context(ctx context.Context) *AcmeChallengeSetsRotateChallengesCall {
396 c.ctx_ = ctx
397 return c
398 }
399
400
401
402 func (c *AcmeChallengeSetsRotateChallengesCall) Header() http.Header {
403 if c.header_ == nil {
404 c.header_ = make(http.Header)
405 }
406 return c.header_
407 }
408
409 func (c *AcmeChallengeSetsRotateChallengesCall) doRequest(alt string) (*http.Response, error) {
410 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
411 var body io.Reader = nil
412 body, err := googleapi.WithoutDataWrapper.JSONReader(c.rotatechallengesrequest)
413 if err != nil {
414 return nil, err
415 }
416 c.urlParams_.Set("alt", alt)
417 c.urlParams_.Set("prettyPrint", "false")
418 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/acmeChallengeSets/{rootDomain}:rotateChallenges")
419 urls += "?" + c.urlParams_.Encode()
420 req, err := http.NewRequest("POST", urls, body)
421 if err != nil {
422 return nil, err
423 }
424 req.Header = reqHeaders
425 googleapi.Expand(req.URL, map[string]string{
426 "rootDomain": c.rootDomain,
427 })
428 return gensupport.SendRequest(c.ctx_, c.s.client, req)
429 }
430
431
432
433
434
435
436
437 func (c *AcmeChallengeSetsRotateChallengesCall) Do(opts ...googleapi.CallOption) (*AcmeChallengeSet, error) {
438 gensupport.SetOptions(c.urlParams_, opts...)
439 res, err := c.doRequest("json")
440 if res != nil && res.StatusCode == http.StatusNotModified {
441 if res.Body != nil {
442 res.Body.Close()
443 }
444 return nil, gensupport.WrapError(&googleapi.Error{
445 Code: res.StatusCode,
446 Header: res.Header,
447 })
448 }
449 if err != nil {
450 return nil, err
451 }
452 defer googleapi.CloseBody(res)
453 if err := googleapi.CheckResponse(res); err != nil {
454 return nil, gensupport.WrapError(err)
455 }
456 ret := &AcmeChallengeSet{
457 ServerResponse: googleapi.ServerResponse{
458 Header: res.Header,
459 HTTPStatusCode: res.StatusCode,
460 },
461 }
462 target := &ret
463 if err := gensupport.DecodeResponse(target, res); err != nil {
464 return nil, err
465 }
466 return ret, nil
467 }
468
View as plain text