-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzonepolicysetversion.go
More file actions
606 lines (558 loc) · 25.6 KB
/
Copy pathzonepolicysetversion.go
File metadata and controls
606 lines (558 loc) · 25.6 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package keycard
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"slices"
"time"
"github.com/keycardai/keycard-go/internal/apijson"
"github.com/keycardai/keycard-go/internal/apiquery"
"github.com/keycardai/keycard-go/internal/requestconfig"
"github.com/keycardai/keycard-go/option"
"github.com/keycardai/keycard-go/packages/param"
"github.com/keycardai/keycard-go/packages/respjson"
)
// Immutable policy set manifest snapshots
//
// ZonePolicySetVersionService contains methods and other services that help with
// interacting with the keycard-api API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewZonePolicySetVersionService] method instead.
type ZonePolicySetVersionService struct {
Options []option.RequestOption
}
// NewZonePolicySetVersionService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewZonePolicySetVersionService(opts ...option.RequestOption) (r ZonePolicySetVersionService) {
r = ZonePolicySetVersionService{}
r.Options = opts
return
}
// Validates the manifest, computes SHA, and creates an immutable version snapshot.
func (r *ZonePolicySetVersionService) New(ctx context.Context, policySetID string, params ZonePolicySetVersionNewParams, opts ...option.RequestOption) (res *PolicySetVersion, err error) {
if !param.IsOmitted(params.XAPIVersion) {
opts = append(opts, option.WithHeader("X-API-Version", fmt.Sprintf("%v", params.XAPIVersion.Value)))
}
if !param.IsOmitted(params.XClientRequestID) {
opts = append(opts, option.WithHeader("X-Client-Request-ID", fmt.Sprintf("%v", params.XClientRequestID.Value)))
}
opts = slices.Concat(r.Options, opts)
if params.ZoneID == "" {
err = errors.New("missing required zone_id parameter")
return nil, err
}
if policySetID == "" {
err = errors.New("missing required policy_set_id parameter")
return nil, err
}
path := fmt.Sprintf("zones/%s/policy-sets/%s/versions", url.PathEscape(params.ZoneID), url.PathEscape(policySetID))
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return res, err
}
// Get a specific policy set version
func (r *ZonePolicySetVersionService) Get(ctx context.Context, versionID string, params ZonePolicySetVersionGetParams, opts ...option.RequestOption) (res *PolicySetVersion, err error) {
if !param.IsOmitted(params.XAPIVersion) {
opts = append(opts, option.WithHeader("X-API-Version", fmt.Sprintf("%v", params.XAPIVersion.Value)))
}
if !param.IsOmitted(params.XClientRequestID) {
opts = append(opts, option.WithHeader("X-Client-Request-ID", fmt.Sprintf("%v", params.XClientRequestID.Value)))
}
opts = slices.Concat(r.Options, opts)
if params.ZoneID == "" {
err = errors.New("missing required zone_id parameter")
return nil, err
}
if params.PolicySetID == "" {
err = errors.New("missing required policy_set_id parameter")
return nil, err
}
if versionID == "" {
err = errors.New("missing required version_id parameter")
return nil, err
}
path := fmt.Sprintf("zones/%s/policy-sets/%s/versions/%s", url.PathEscape(params.ZoneID), url.PathEscape(params.PolicySetID), url.PathEscape(versionID))
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &res, opts...)
return res, err
}
// Set active=true to bind this version as the active zone policy set.
func (r *ZonePolicySetVersionService) Update(ctx context.Context, versionID string, params ZonePolicySetVersionUpdateParams, opts ...option.RequestOption) (res *PolicySetVersion, err error) {
if !param.IsOmitted(params.XAPIVersion) {
opts = append(opts, option.WithHeader("X-API-Version", fmt.Sprintf("%v", params.XAPIVersion.Value)))
}
if !param.IsOmitted(params.XClientRequestID) {
opts = append(opts, option.WithHeader("X-Client-Request-ID", fmt.Sprintf("%v", params.XClientRequestID.Value)))
}
opts = slices.Concat(r.Options, opts)
if params.ZoneID == "" {
err = errors.New("missing required zone_id parameter")
return nil, err
}
if params.PolicySetID == "" {
err = errors.New("missing required policy_set_id parameter")
return nil, err
}
if versionID == "" {
err = errors.New("missing required version_id parameter")
return nil, err
}
path := fmt.Sprintf("zones/%s/policy-sets/%s/versions/%s", url.PathEscape(params.ZoneID), url.PathEscape(params.PolicySetID), url.PathEscape(versionID))
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &res, opts...)
return res, err
}
// List versions of a policy set
func (r *ZonePolicySetVersionService) List(ctx context.Context, policySetID string, params ZonePolicySetVersionListParams, opts ...option.RequestOption) (res *ZonePolicySetVersionListResponse, err error) {
if !param.IsOmitted(params.XAPIVersion) {
opts = append(opts, option.WithHeader("X-API-Version", fmt.Sprintf("%v", params.XAPIVersion.Value)))
}
if !param.IsOmitted(params.XClientRequestID) {
opts = append(opts, option.WithHeader("X-Client-Request-ID", fmt.Sprintf("%v", params.XClientRequestID.Value)))
}
opts = slices.Concat(r.Options, opts)
if params.ZoneID == "" {
err = errors.New("missing required zone_id parameter")
return nil, err
}
if policySetID == "" {
err = errors.New("missing required policy_set_id parameter")
return nil, err
}
path := fmt.Sprintf("zones/%s/policy-sets/%s/versions", url.PathEscape(params.ZoneID), url.PathEscape(policySetID))
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &res, opts...)
return res, err
}
// Archive a policy set version
func (r *ZonePolicySetVersionService) Archive(ctx context.Context, versionID string, params ZonePolicySetVersionArchiveParams, opts ...option.RequestOption) (res *PolicySetVersion, err error) {
if !param.IsOmitted(params.XAPIVersion) {
opts = append(opts, option.WithHeader("X-API-Version", fmt.Sprintf("%v", params.XAPIVersion.Value)))
}
if !param.IsOmitted(params.XClientRequestID) {
opts = append(opts, option.WithHeader("X-Client-Request-ID", fmt.Sprintf("%v", params.XClientRequestID.Value)))
}
opts = slices.Concat(r.Options, opts)
if params.ZoneID == "" {
err = errors.New("missing required zone_id parameter")
return nil, err
}
if params.PolicySetID == "" {
err = errors.New("missing required policy_set_id parameter")
return nil, err
}
if versionID == "" {
err = errors.New("missing required version_id parameter")
return nil, err
}
path := fmt.Sprintf("zones/%s/policy-sets/%s/versions/%s", url.PathEscape(params.ZoneID), url.PathEscape(params.PolicySetID), url.PathEscape(versionID))
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
// Returns the policy versions referenced by this policy set version's manifest as
// a paginated list.
func (r *ZonePolicySetVersionService) ListPolicies(ctx context.Context, versionID string, params ZonePolicySetVersionListPoliciesParams, opts ...option.RequestOption) (res *ZonePolicySetVersionListPoliciesResponse, err error) {
if !param.IsOmitted(params.XAPIVersion) {
opts = append(opts, option.WithHeader("X-API-Version", fmt.Sprintf("%v", params.XAPIVersion.Value)))
}
if !param.IsOmitted(params.XClientRequestID) {
opts = append(opts, option.WithHeader("X-Client-Request-ID", fmt.Sprintf("%v", params.XClientRequestID.Value)))
}
opts = slices.Concat(r.Options, opts)
if params.ZoneID == "" {
err = errors.New("missing required zone_id parameter")
return nil, err
}
if params.PolicySetID == "" {
err = errors.New("missing required policy_set_id parameter")
return nil, err
}
if versionID == "" {
err = errors.New("missing required version_id parameter")
return nil, err
}
path := fmt.Sprintf("zones/%s/policy-sets/%s/versions/%s/policies", url.PathEscape(params.ZoneID), url.PathEscape(params.PolicySetID), url.PathEscape(versionID))
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &res, opts...)
return res, err
}
type PolicySetVersion struct {
ID string `json:"id" api:"required"`
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
CreatedBy string `json:"created_by" api:"required"`
Manifest PolicySetManifest `json:"manifest" api:"required"`
// Hex-encoded SHA-256 of the canonicalized manifest
ManifestSha string `json:"manifest_sha" api:"required"`
// Who manages this policy set version:
//
// - `"platform"` — managed by the Keycard platform (system policy set versions).
// - `"customer"` — managed by the tenant (custom policy set versions).
//
// Any of "platform", "customer".
OwnerType PolicySetVersionOwnerType `json:"owner_type" api:"required"`
PolicySetID string `json:"policy_set_id" api:"required"`
// Schema version pinned to this policy set version. Determines the Cedar schema
// used for evaluation when activated.
SchemaVersion string `json:"schema_version" api:"required"`
Version int64 `json:"version" api:"required"`
// Whether this policy set version is currently bound with mode='active'. Always
// populated in responses; clients must treat absence as unknown rather than
// inferring 'not bound'.
Active bool `json:"active"`
// Timestamp when the version was archived. Non-null only for archived versions;
// null or absent means not archived.
ArchivedAt time.Time `json:"archived_at" api:"nullable" format:"date-time"`
// Identifier of the actor that archived the version. Null or absent means not
// archived.
ArchivedBy string `json:"archived_by" api:"nullable"`
// The organization user behind a `created_by`, `updated_by` or `archived_by`
// value. Returned only when `expand[]=user` is requested.
ArchivedByUser PolicySetVersionArchivedByUser `json:"archived_by_user"`
// Decoded content of an Attestation JWS payload. Describes the exact policy set
// version composition at attestation time. This schema defines what consumers see
// after base64url-decoding the Attestation.payload field.
Attestation AttestationStatement `json:"attestation" api:"nullable"`
// The organization user behind a `created_by`, `updated_by` or `archived_by`
// value. Returned only when `expand[]=user` is requested.
CreatedByUser PolicySetVersionCreatedByUser `json:"created_by_user"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
CreatedBy respjson.Field
Manifest respjson.Field
ManifestSha respjson.Field
OwnerType respjson.Field
PolicySetID respjson.Field
SchemaVersion respjson.Field
Version respjson.Field
Active respjson.Field
ArchivedAt respjson.Field
ArchivedBy respjson.Field
ArchivedByUser respjson.Field
Attestation respjson.Field
CreatedByUser respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r PolicySetVersion) RawJSON() string { return r.JSON.raw }
func (r *PolicySetVersion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Who manages this policy set version:
//
// - `"platform"` — managed by the Keycard platform (system policy set versions).
// - `"customer"` — managed by the tenant (custom policy set versions).
type PolicySetVersionOwnerType string
const (
PolicySetVersionOwnerTypePlatform PolicySetVersionOwnerType = "platform"
PolicySetVersionOwnerTypeCustomer PolicySetVersionOwnerType = "customer"
)
// The organization user behind a `created_by`, `updated_by` or `archived_by`
// value. Returned only when `expand[]=user` is requested.
type PolicySetVersionArchivedByUser struct {
// Public ID of the user in the organization's platform zone. This is not the same
// value as the `*_by` field it expands; use it to link to
// `/zones/{zone_id}/users/{id}`.
ID string `json:"id" api:"required"`
// The user's email address, or null when not known.
Email string `json:"email" api:"required"`
// Public ID of the organization's platform zone the user belongs to.
ZoneID string `json:"zone_id" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Email respjson.Field
ZoneID respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r PolicySetVersionArchivedByUser) RawJSON() string { return r.JSON.raw }
func (r *PolicySetVersionArchivedByUser) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// The organization user behind a `created_by`, `updated_by` or `archived_by`
// value. Returned only when `expand[]=user` is requested.
type PolicySetVersionCreatedByUser struct {
// Public ID of the user in the organization's platform zone. This is not the same
// value as the `*_by` field it expands; use it to link to
// `/zones/{zone_id}/users/{id}`.
ID string `json:"id" api:"required"`
// The user's email address, or null when not known.
Email string `json:"email" api:"required"`
// Public ID of the organization's platform zone the user belongs to.
ZoneID string `json:"zone_id" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Email respjson.Field
ZoneID respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r PolicySetVersionCreatedByUser) RawJSON() string { return r.JSON.raw }
func (r *PolicySetVersionCreatedByUser) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type ZonePolicySetVersionListResponse struct {
Items []PolicySetVersion `json:"items" api:"required"`
// Cursor-based pagination metadata returned alongside a list of results
Pagination ZonePolicySetVersionListResponsePagination `json:"pagination" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Items respjson.Field
Pagination respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r ZonePolicySetVersionListResponse) RawJSON() string { return r.JSON.raw }
func (r *ZonePolicySetVersionListResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Cursor-based pagination metadata returned alongside a list of results
type ZonePolicySetVersionListResponsePagination struct {
// An opaque cursor used for paginating through a list of results
AfterCursor string `json:"after_cursor" api:"required"`
// An opaque cursor used for paginating through a list of results
BeforeCursor string `json:"before_cursor" api:"required"`
// Total number of items across all pages. Only present when the request includes
// ?expand[]=total_count.
TotalCount int64 `json:"total_count"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AfterCursor respjson.Field
BeforeCursor respjson.Field
TotalCount respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r ZonePolicySetVersionListResponsePagination) RawJSON() string { return r.JSON.raw }
func (r *ZonePolicySetVersionListResponsePagination) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type ZonePolicySetVersionListPoliciesResponse struct {
Items []PolicyVersion `json:"items" api:"required"`
// Cursor-based pagination metadata returned alongside a list of results
Pagination ZonePolicySetVersionListPoliciesResponsePagination `json:"pagination" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Items respjson.Field
Pagination respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r ZonePolicySetVersionListPoliciesResponse) RawJSON() string { return r.JSON.raw }
func (r *ZonePolicySetVersionListPoliciesResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Cursor-based pagination metadata returned alongside a list of results
type ZonePolicySetVersionListPoliciesResponsePagination struct {
// An opaque cursor used for paginating through a list of results
AfterCursor string `json:"after_cursor" api:"required"`
// An opaque cursor used for paginating through a list of results
BeforeCursor string `json:"before_cursor" api:"required"`
// Total number of items across all pages. Only present when the request includes
// ?expand[]=total_count.
TotalCount int64 `json:"total_count"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AfterCursor respjson.Field
BeforeCursor respjson.Field
TotalCount respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r ZonePolicySetVersionListPoliciesResponsePagination) RawJSON() string { return r.JSON.raw }
func (r *ZonePolicySetVersionListPoliciesResponsePagination) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type ZonePolicySetVersionNewParams struct {
ZoneID string `path:"zone_id" api:"required" json:"-"`
Manifest PolicySetManifestParam `json:"manifest,omitzero" api:"required"`
// Schema version to pin to this policy set version.
SchemaVersion string `json:"schema_version" api:"required"`
XAPIVersion param.Opt[string] `header:"X-API-Version,omitzero" json:"-"`
XClientRequestID param.Opt[string] `header:"X-Client-Request-ID,omitzero" format:"uuid" json:"-"`
paramObj
}
func (r ZonePolicySetVersionNewParams) MarshalJSON() (data []byte, err error) {
type shadow ZonePolicySetVersionNewParams
return param.MarshalObject(r, (*shadow)(&r))
}
func (r *ZonePolicySetVersionNewParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type ZonePolicySetVersionGetParams struct {
ZoneID string `path:"zone_id" api:"required" json:"-"`
PolicySetID string `path:"policy_set_id" api:"required" json:"-"`
XAPIVersion param.Opt[string] `header:"X-API-Version,omitzero" json:"-"`
XClientRequestID param.Opt[string] `header:"X-Client-Request-ID,omitzero" format:"uuid" json:"-"`
// Opt-in to additional response fields on a single resource (`user`). Repeatable.
//
// Any of "user".
Expand []string `query:"expand,omitzero" json:"-"`
paramObj
}
// URLQuery serializes [ZonePolicySetVersionGetParams]'s query parameters as
// `url.Values`.
func (r ZonePolicySetVersionGetParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type ZonePolicySetVersionUpdateParams struct {
ZoneID string `path:"zone_id" api:"required" json:"-"`
PolicySetID string `path:"policy_set_id" api:"required" json:"-"`
// Must be true. Binds this version as the active zone policy set.
//
// Any of true.
Active bool `json:"active,omitzero" api:"required"`
XAPIVersion param.Opt[string] `header:"X-API-Version,omitzero" json:"-"`
XClientRequestID param.Opt[string] `header:"X-Client-Request-ID,omitzero" format:"uuid" json:"-"`
paramObj
}
func (r ZonePolicySetVersionUpdateParams) MarshalJSON() (data []byte, err error) {
type shadow ZonePolicySetVersionUpdateParams
return param.MarshalObject(r, (*shadow)(&r))
}
func (r *ZonePolicySetVersionUpdateParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type ZonePolicySetVersionListParams struct {
ZoneID string `path:"zone_id" api:"required" json:"-"`
// Cursor for forward pagination. Returned in `Pagination.after_cursor`. Mutually
// exclusive with `before`.
After param.Opt[string] `query:"after,omitzero" json:"-"`
// Cursor for backward pagination. Returned in `Pagination.before_cursor`. Mutually
// exclusive with `after`.
Before param.Opt[string] `query:"before,omitzero" json:"-"`
// Maximum number of items to return per page.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
XAPIVersion param.Opt[string] `header:"X-API-Version,omitzero" json:"-"`
XClientRequestID param.Opt[string] `header:"X-Client-Request-ID,omitzero" format:"uuid" json:"-"`
// **Deprecated.** Use `expand[]` instead.
//
// Opt-in to additional response fields. Still honored for backward compatibility;
// supplying both `expand` and `expand[]` with disagreeing values returns
// `400 Bad Request`.
//
// Any of "total_count", "user".
Expand []string `query:"expand,omitzero" json:"-"`
// Sort direction. Default is desc (newest first).
//
// Any of "asc", "desc".
Order ZonePolicySetVersionListParamsOrder `query:"order,omitzero" json:"-"`
// Field to sort by.
//
// Any of "created_at".
Sort ZonePolicySetVersionListParamsSort `query:"sort,omitzero" json:"-"`
paramObj
}
// URLQuery serializes [ZonePolicySetVersionListParams]'s query parameters as
// `url.Values`.
func (r ZonePolicySetVersionListParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Sort direction. Default is desc (newest first).
type ZonePolicySetVersionListParamsOrder string
const (
ZonePolicySetVersionListParamsOrderAsc ZonePolicySetVersionListParamsOrder = "asc"
ZonePolicySetVersionListParamsOrderDesc ZonePolicySetVersionListParamsOrder = "desc"
)
// Field to sort by.
type ZonePolicySetVersionListParamsSort string
const (
ZonePolicySetVersionListParamsSortCreatedAt ZonePolicySetVersionListParamsSort = "created_at"
)
type ZonePolicySetVersionArchiveParams struct {
ZoneID string `path:"zone_id" api:"required" json:"-"`
PolicySetID string `path:"policy_set_id" api:"required" json:"-"`
XAPIVersion param.Opt[string] `header:"X-API-Version,omitzero" json:"-"`
XClientRequestID param.Opt[string] `header:"X-Client-Request-ID,omitzero" format:"uuid" json:"-"`
paramObj
}
type ZonePolicySetVersionListPoliciesParams struct {
ZoneID string `path:"zone_id" api:"required" json:"-"`
PolicySetID string `path:"policy_set_id" api:"required" json:"-"`
// Cursor for forward pagination. Returned in `Pagination.after_cursor`. Mutually
// exclusive with `before`.
After param.Opt[string] `query:"after,omitzero" json:"-"`
// Cursor for backward pagination. Returned in `Pagination.before_cursor`. Mutually
// exclusive with `after`.
Before param.Opt[string] `query:"before,omitzero" json:"-"`
// Maximum number of items to return per page.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
XAPIVersion param.Opt[string] `header:"X-API-Version,omitzero" json:"-"`
XClientRequestID param.Opt[string] `header:"X-Client-Request-ID,omitzero" format:"uuid" json:"-"`
// **Deprecated.** Use `expand[]` instead.
//
// Opt-in to additional response fields. Still honored for backward compatibility;
// supplying both `expand` and `expand[]` with disagreeing values returns
// `400 Bad Request`.
//
// Any of "total_count", "user".
Expand []string `query:"expand,omitzero" json:"-"`
// Narrows which Cedar representation the response includes. When omitted, both
// `cedar_json` and `cedar_raw` are populated. Pass `json` to receive only
// `cedar_json`, or `cedar` to receive only `cedar_raw`. Callers that don't care
// about payload size can skip this parameter.
//
// Any of "cedar", "json".
Format ZonePolicySetVersionListPoliciesParamsFormat `query:"format,omitzero" json:"-"`
// Sort direction. Default is desc (newest first).
//
// Any of "asc", "desc".
Order ZonePolicySetVersionListPoliciesParamsOrder `query:"order,omitzero" json:"-"`
// Field to sort by.
//
// Any of "created_at".
Sort ZonePolicySetVersionListPoliciesParamsSort `query:"sort,omitzero" json:"-"`
paramObj
}
// URLQuery serializes [ZonePolicySetVersionListPoliciesParams]'s query parameters
// as `url.Values`.
func (r ZonePolicySetVersionListPoliciesParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Narrows which Cedar representation the response includes. When omitted, both
// `cedar_json` and `cedar_raw` are populated. Pass `json` to receive only
// `cedar_json`, or `cedar` to receive only `cedar_raw`. Callers that don't care
// about payload size can skip this parameter.
type ZonePolicySetVersionListPoliciesParamsFormat string
const (
ZonePolicySetVersionListPoliciesParamsFormatCedar ZonePolicySetVersionListPoliciesParamsFormat = "cedar"
ZonePolicySetVersionListPoliciesParamsFormatJson ZonePolicySetVersionListPoliciesParamsFormat = "json"
)
// Sort direction. Default is desc (newest first).
type ZonePolicySetVersionListPoliciesParamsOrder string
const (
ZonePolicySetVersionListPoliciesParamsOrderAsc ZonePolicySetVersionListPoliciesParamsOrder = "asc"
ZonePolicySetVersionListPoliciesParamsOrderDesc ZonePolicySetVersionListPoliciesParamsOrder = "desc"
)
// Field to sort by.
type ZonePolicySetVersionListPoliciesParamsSort string
const (
ZonePolicySetVersionListPoliciesParamsSortCreatedAt ZonePolicySetVersionListPoliciesParamsSort = "created_at"
)