Skip to content

Commit 3fc80d9

Browse files
committedJan 30, 2025
feat(api): api update (#3855)
1 parent b17ebd4 commit 3fc80d9

9 files changed

+265
-45
lines changed
 

‎.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1493
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1e73ee53fddc61d4ddfa1837bcbc2792e682a435439373fff24a718b4d8f7783.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ed24ef293c8f10ea1c884e533b435244b266e97c6e01211430ac9d39e6daebb0.yml

‎shared/union.go

+8
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsBodyDeviceEnr
6969
}
7070
func (UnionString) ImplementsZeroTrustAccessApplicationUpdateParamsBodyBrowserIsolationPermissionsApplicationPolicyUnion() {
7171
}
72+
func (UnionString) ImplementsZeroTrustDLPEmailRuleNewResponseConditionsValueUnion() {}
73+
func (UnionString) ImplementsZeroTrustDLPEmailRuleUpdateResponseConditionsValueUnion() {}
74+
func (UnionString) ImplementsZeroTrustDLPEmailRuleListResponseConditionsValueUnion() {}
75+
func (UnionString) ImplementsZeroTrustDLPEmailRuleDeleteResponseConditionsValueUnion() {}
76+
func (UnionString) ImplementsZeroTrustDLPEmailRuleBulkEditResponseConditionsValueUnion() {}
77+
func (UnionString) ImplementsZeroTrustDLPEmailRuleGetResponseConditionsValueUnion() {}
78+
func (UnionString) ImplementsZeroTrustDLPEmailRuleNewParamsConditionsValueUnion() {}
79+
func (UnionString) ImplementsZeroTrustDLPEmailRuleUpdateParamsConditionsValueUnion() {}
7280
func (UnionString) ImplementsRadarRankingTimeseriesGroupsResponseSerie0Union() {}
7381
func (UnionString) ImplementsHostnamesSettingValueUnionParam() {}
7482
func (UnionString) ImplementsHostnamesSettingValueUnion() {}

‎url_scanner/scan.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ func (r *ScanService) New(ctx context.Context, params ScanNewParams, opts ...opt
5959
// "microsoft".<br/>- 'apikey:me AND date:[2024-01 TO 2024-10]': my scans from 2024
6060
// January to 2024 October.<br/>- 'page.domain:(blogspot OR www.blogspot)':
6161
// Searches for scans whose main domain starts with "blogspot" or with
62-
// "www.blogspot"<br/>- 'date:>now-7d AND path:okta-sign-in.min.js: scans from the
63-
// last 7 days with any request path that ends with "okta-sign-in.min.js"<br/>-
64-
// 'page.asn:AS24940 AND hash:xxx': Websites hosted in AS24940 where a resource
65-
// with the given hash was downloaded.
62+
// "www.blogspot"<br/>- 'page.asn:AS24940 AND hash:xxx': Websites hosted in AS24940
63+
// where a resource with the given hash was downloaded.
6664
func (r *ScanService) List(ctx context.Context, params ScanListParams, opts ...option.RequestOption) (res *ScanListResponse, err error) {
6765
opts = append(r.Options[:], opts...)
6866
if params.AccountID.Value == "" {

‎zero_trust/dlpdatasetupload.go

+18-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
package zero_trust
44

55
import (
6+
"bytes"
67
"context"
78
"errors"
89
"fmt"
10+
"io"
11+
"mime/multipart"
912
"net/http"
1013

14+
"github.com/cloudflare/cloudflare-go/v4/internal/apiform"
1115
"github.com/cloudflare/cloudflare-go/v4/internal/apijson"
1216
"github.com/cloudflare/cloudflare-go/v4/internal/param"
1317
"github.com/cloudflare/cloudflare-go/v4/internal/requestconfig"
@@ -201,11 +205,22 @@ func (r DLPDatasetUploadNewResponseEnvelopeSuccess) IsKnown() bool {
201205

202206
type DLPDatasetUploadEditParams struct {
203207
AccountID param.Field[string] `path:"account_id,required"`
204-
Body string `json:"body,required"`
208+
Body io.Reader `json:"body,required" format:"binary"`
205209
}
206210

207-
func (r DLPDatasetUploadEditParams) MarshalJSON() (data []byte, err error) {
208-
return apijson.MarshalRoot(r.Body)
211+
func (r DLPDatasetUploadEditParams) MarshalMultipart() (data []byte, contentType string, err error) {
212+
buf := bytes.NewBuffer(nil)
213+
writer := multipart.NewWriter(buf)
214+
err = apiform.MarshalRoot(r, writer)
215+
if err != nil {
216+
writer.Close()
217+
return nil, "", err
218+
}
219+
err = writer.Close()
220+
if err != nil {
221+
return nil, "", err
222+
}
223+
return buf.Bytes(), writer.FormDataContentType(), nil
209224
}
210225

211226
type DLPDatasetUploadEditResponseEnvelope struct {

‎zero_trust/dlpdatasetupload_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
package zero_trust_test
44

55
import (
6+
"bytes"
67
"context"
78
"errors"
9+
"io"
810
"os"
911
"testing"
1012

@@ -63,7 +65,7 @@ func TestDLPDatasetUploadEdit(t *testing.T) {
6365
int64(0),
6466
zero_trust.DLPDatasetUploadEditParams{
6567
AccountID: cloudflare.F("account_id"),
66-
Body: "body",
68+
Body: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
6769
},
6870
)
6971
if err != nil {

‎zero_trust/dlpdatasetversionentry.go

+18-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
package zero_trust
44

55
import (
6+
"bytes"
67
"context"
78
"errors"
89
"fmt"
10+
"io"
11+
"mime/multipart"
912
"net/http"
1013

14+
"github.com/cloudflare/cloudflare-go/v4/internal/apiform"
1115
"github.com/cloudflare/cloudflare-go/v4/internal/apijson"
1216
"github.com/cloudflare/cloudflare-go/v4/internal/param"
1317
"github.com/cloudflare/cloudflare-go/v4/internal/requestconfig"
@@ -107,11 +111,22 @@ func (r DLPDatasetVersionEntryNewResponseUploadStatus) IsKnown() bool {
107111

108112
type DLPDatasetVersionEntryNewParams struct {
109113
AccountID param.Field[string] `path:"account_id,required"`
110-
Body string `json:"body,required"`
114+
Body io.Reader `json:"body,required" format:"binary"`
111115
}
112116

113-
func (r DLPDatasetVersionEntryNewParams) MarshalJSON() (data []byte, err error) {
114-
return apijson.MarshalRoot(r.Body)
117+
func (r DLPDatasetVersionEntryNewParams) MarshalMultipart() (data []byte, contentType string, err error) {
118+
buf := bytes.NewBuffer(nil)
119+
writer := multipart.NewWriter(buf)
120+
err = apiform.MarshalRoot(r, writer)
121+
if err != nil {
122+
writer.Close()
123+
return nil, "", err
124+
}
125+
err = writer.Close()
126+
if err != nil {
127+
return nil, "", err
128+
}
129+
return buf.Bytes(), writer.FormDataContentType(), nil
115130
}
116131

117132
type DLPDatasetVersionEntryNewResponseEnvelope struct {

‎zero_trust/dlpdatasetversionentry_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
package zero_trust_test
44

55
import (
6+
"bytes"
67
"context"
78
"errors"
9+
"io"
810
"os"
911
"testing"
1012

@@ -35,7 +37,7 @@ func TestDLPDatasetVersionEntryNew(t *testing.T) {
3537
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
3638
zero_trust.DLPDatasetVersionEntryNewParams{
3739
AccountID: cloudflare.F("account_id"),
38-
Body: "body",
40+
Body: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
3941
},
4042
)
4143
if err != nil {

‎zero_trust/dlpemailrule.go

+210-30
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"errors"
88
"fmt"
99
"net/http"
10+
"reflect"
1011
"time"
1112

1213
"github.com/cloudflare/cloudflare-go/v4/internal/apijson"
@@ -15,6 +16,7 @@ import (
1516
"github.com/cloudflare/cloudflare-go/v4/option"
1617
"github.com/cloudflare/cloudflare-go/v4/packages/pagination"
1718
"github.com/cloudflare/cloudflare-go/v4/shared"
19+
"github.com/tidwall/gjson"
1820
)
1921

2022
// DLPEmailRuleService contains methods and other services that help with
@@ -236,10 +238,10 @@ func (r DLPEmailRuleNewResponseActionAction) IsKnown() bool {
236238
}
237239

238240
type DLPEmailRuleNewResponseCondition struct {
239-
Operator DLPEmailRuleNewResponseConditionsOperator `json:"operator,required"`
240-
Selector DLPEmailRuleNewResponseConditionsSelector `json:"selector,required"`
241-
Value interface{} `json:"value,required"`
242-
JSON dlpEmailRuleNewResponseConditionJSON `json:"-"`
241+
Operator DLPEmailRuleNewResponseConditionsOperator `json:"operator,required"`
242+
Selector DLPEmailRuleNewResponseConditionsSelector `json:"selector,required"`
243+
Value DLPEmailRuleNewResponseConditionsValueUnion `json:"value,required"`
244+
JSON dlpEmailRuleNewResponseConditionJSON `json:"-"`
243245
}
244246

245247
// dlpEmailRuleNewResponseConditionJSON contains the JSON metadata for the struct
@@ -293,6 +295,32 @@ func (r DLPEmailRuleNewResponseConditionsSelector) IsKnown() bool {
293295
return false
294296
}
295297

298+
// Union satisfied by [zero_trust.DLPEmailRuleNewResponseConditionsValueArray] or
299+
// [shared.UnionString].
300+
type DLPEmailRuleNewResponseConditionsValueUnion interface {
301+
ImplementsZeroTrustDLPEmailRuleNewResponseConditionsValueUnion()
302+
}
303+
304+
func init() {
305+
apijson.RegisterUnion(
306+
reflect.TypeOf((*DLPEmailRuleNewResponseConditionsValueUnion)(nil)).Elem(),
307+
"",
308+
apijson.UnionVariant{
309+
TypeFilter: gjson.JSON,
310+
Type: reflect.TypeOf(DLPEmailRuleNewResponseConditionsValueArray{}),
311+
},
312+
apijson.UnionVariant{
313+
TypeFilter: gjson.String,
314+
Type: reflect.TypeOf(shared.UnionString("")),
315+
},
316+
)
317+
}
318+
319+
type DLPEmailRuleNewResponseConditionsValueArray []string
320+
321+
func (r DLPEmailRuleNewResponseConditionsValueArray) ImplementsZeroTrustDLPEmailRuleNewResponseConditionsValueUnion() {
322+
}
323+
296324
type DLPEmailRuleUpdateResponse struct {
297325
Action DLPEmailRuleUpdateResponseAction `json:"action,required"`
298326
// Rule is triggered if all conditions match
@@ -369,10 +397,10 @@ func (r DLPEmailRuleUpdateResponseActionAction) IsKnown() bool {
369397
}
370398

371399
type DLPEmailRuleUpdateResponseCondition struct {
372-
Operator DLPEmailRuleUpdateResponseConditionsOperator `json:"operator,required"`
373-
Selector DLPEmailRuleUpdateResponseConditionsSelector `json:"selector,required"`
374-
Value interface{} `json:"value,required"`
375-
JSON dlpEmailRuleUpdateResponseConditionJSON `json:"-"`
400+
Operator DLPEmailRuleUpdateResponseConditionsOperator `json:"operator,required"`
401+
Selector DLPEmailRuleUpdateResponseConditionsSelector `json:"selector,required"`
402+
Value DLPEmailRuleUpdateResponseConditionsValueUnion `json:"value,required"`
403+
JSON dlpEmailRuleUpdateResponseConditionJSON `json:"-"`
376404
}
377405

378406
// dlpEmailRuleUpdateResponseConditionJSON contains the JSON metadata for the
@@ -426,6 +454,32 @@ func (r DLPEmailRuleUpdateResponseConditionsSelector) IsKnown() bool {
426454
return false
427455
}
428456

457+
// Union satisfied by [zero_trust.DLPEmailRuleUpdateResponseConditionsValueArray]
458+
// or [shared.UnionString].
459+
type DLPEmailRuleUpdateResponseConditionsValueUnion interface {
460+
ImplementsZeroTrustDLPEmailRuleUpdateResponseConditionsValueUnion()
461+
}
462+
463+
func init() {
464+
apijson.RegisterUnion(
465+
reflect.TypeOf((*DLPEmailRuleUpdateResponseConditionsValueUnion)(nil)).Elem(),
466+
"",
467+
apijson.UnionVariant{
468+
TypeFilter: gjson.JSON,
469+
Type: reflect.TypeOf(DLPEmailRuleUpdateResponseConditionsValueArray{}),
470+
},
471+
apijson.UnionVariant{
472+
TypeFilter: gjson.String,
473+
Type: reflect.TypeOf(shared.UnionString("")),
474+
},
475+
)
476+
}
477+
478+
type DLPEmailRuleUpdateResponseConditionsValueArray []string
479+
480+
func (r DLPEmailRuleUpdateResponseConditionsValueArray) ImplementsZeroTrustDLPEmailRuleUpdateResponseConditionsValueUnion() {
481+
}
482+
429483
type DLPEmailRuleListResponse struct {
430484
Action DLPEmailRuleListResponseAction `json:"action,required"`
431485
// Rule is triggered if all conditions match
@@ -502,10 +556,10 @@ func (r DLPEmailRuleListResponseActionAction) IsKnown() bool {
502556
}
503557

504558
type DLPEmailRuleListResponseCondition struct {
505-
Operator DLPEmailRuleListResponseConditionsOperator `json:"operator,required"`
506-
Selector DLPEmailRuleListResponseConditionsSelector `json:"selector,required"`
507-
Value interface{} `json:"value,required"`
508-
JSON dlpEmailRuleListResponseConditionJSON `json:"-"`
559+
Operator DLPEmailRuleListResponseConditionsOperator `json:"operator,required"`
560+
Selector DLPEmailRuleListResponseConditionsSelector `json:"selector,required"`
561+
Value DLPEmailRuleListResponseConditionsValueUnion `json:"value,required"`
562+
JSON dlpEmailRuleListResponseConditionJSON `json:"-"`
509563
}
510564

511565
// dlpEmailRuleListResponseConditionJSON contains the JSON metadata for the struct
@@ -559,6 +613,32 @@ func (r DLPEmailRuleListResponseConditionsSelector) IsKnown() bool {
559613
return false
560614
}
561615

616+
// Union satisfied by [zero_trust.DLPEmailRuleListResponseConditionsValueArray] or
617+
// [shared.UnionString].
618+
type DLPEmailRuleListResponseConditionsValueUnion interface {
619+
ImplementsZeroTrustDLPEmailRuleListResponseConditionsValueUnion()
620+
}
621+
622+
func init() {
623+
apijson.RegisterUnion(
624+
reflect.TypeOf((*DLPEmailRuleListResponseConditionsValueUnion)(nil)).Elem(),
625+
"",
626+
apijson.UnionVariant{
627+
TypeFilter: gjson.JSON,
628+
Type: reflect.TypeOf(DLPEmailRuleListResponseConditionsValueArray{}),
629+
},
630+
apijson.UnionVariant{
631+
TypeFilter: gjson.String,
632+
Type: reflect.TypeOf(shared.UnionString("")),
633+
},
634+
)
635+
}
636+
637+
type DLPEmailRuleListResponseConditionsValueArray []string
638+
639+
func (r DLPEmailRuleListResponseConditionsValueArray) ImplementsZeroTrustDLPEmailRuleListResponseConditionsValueUnion() {
640+
}
641+
562642
type DLPEmailRuleDeleteResponse struct {
563643
Action DLPEmailRuleDeleteResponseAction `json:"action,required"`
564644
// Rule is triggered if all conditions match
@@ -635,10 +715,10 @@ func (r DLPEmailRuleDeleteResponseActionAction) IsKnown() bool {
635715
}
636716

637717
type DLPEmailRuleDeleteResponseCondition struct {
638-
Operator DLPEmailRuleDeleteResponseConditionsOperator `json:"operator,required"`
639-
Selector DLPEmailRuleDeleteResponseConditionsSelector `json:"selector,required"`
640-
Value interface{} `json:"value,required"`
641-
JSON dlpEmailRuleDeleteResponseConditionJSON `json:"-"`
718+
Operator DLPEmailRuleDeleteResponseConditionsOperator `json:"operator,required"`
719+
Selector DLPEmailRuleDeleteResponseConditionsSelector `json:"selector,required"`
720+
Value DLPEmailRuleDeleteResponseConditionsValueUnion `json:"value,required"`
721+
JSON dlpEmailRuleDeleteResponseConditionJSON `json:"-"`
642722
}
643723

644724
// dlpEmailRuleDeleteResponseConditionJSON contains the JSON metadata for the
@@ -692,6 +772,32 @@ func (r DLPEmailRuleDeleteResponseConditionsSelector) IsKnown() bool {
692772
return false
693773
}
694774

775+
// Union satisfied by [zero_trust.DLPEmailRuleDeleteResponseConditionsValueArray]
776+
// or [shared.UnionString].
777+
type DLPEmailRuleDeleteResponseConditionsValueUnion interface {
778+
ImplementsZeroTrustDLPEmailRuleDeleteResponseConditionsValueUnion()
779+
}
780+
781+
func init() {
782+
apijson.RegisterUnion(
783+
reflect.TypeOf((*DLPEmailRuleDeleteResponseConditionsValueUnion)(nil)).Elem(),
784+
"",
785+
apijson.UnionVariant{
786+
TypeFilter: gjson.JSON,
787+
Type: reflect.TypeOf(DLPEmailRuleDeleteResponseConditionsValueArray{}),
788+
},
789+
apijson.UnionVariant{
790+
TypeFilter: gjson.String,
791+
Type: reflect.TypeOf(shared.UnionString("")),
792+
},
793+
)
794+
}
795+
796+
type DLPEmailRuleDeleteResponseConditionsValueArray []string
797+
798+
func (r DLPEmailRuleDeleteResponseConditionsValueArray) ImplementsZeroTrustDLPEmailRuleDeleteResponseConditionsValueUnion() {
799+
}
800+
695801
type DLPEmailRuleBulkEditResponse struct {
696802
Action DLPEmailRuleBulkEditResponseAction `json:"action,required"`
697803
// Rule is triggered if all conditions match
@@ -768,10 +874,10 @@ func (r DLPEmailRuleBulkEditResponseActionAction) IsKnown() bool {
768874
}
769875

770876
type DLPEmailRuleBulkEditResponseCondition struct {
771-
Operator DLPEmailRuleBulkEditResponseConditionsOperator `json:"operator,required"`
772-
Selector DLPEmailRuleBulkEditResponseConditionsSelector `json:"selector,required"`
773-
Value interface{} `json:"value,required"`
774-
JSON dlpEmailRuleBulkEditResponseConditionJSON `json:"-"`
877+
Operator DLPEmailRuleBulkEditResponseConditionsOperator `json:"operator,required"`
878+
Selector DLPEmailRuleBulkEditResponseConditionsSelector `json:"selector,required"`
879+
Value DLPEmailRuleBulkEditResponseConditionsValueUnion `json:"value,required"`
880+
JSON dlpEmailRuleBulkEditResponseConditionJSON `json:"-"`
775881
}
776882

777883
// dlpEmailRuleBulkEditResponseConditionJSON contains the JSON metadata for the
@@ -825,6 +931,32 @@ func (r DLPEmailRuleBulkEditResponseConditionsSelector) IsKnown() bool {
825931
return false
826932
}
827933

934+
// Union satisfied by [zero_trust.DLPEmailRuleBulkEditResponseConditionsValueArray]
935+
// or [shared.UnionString].
936+
type DLPEmailRuleBulkEditResponseConditionsValueUnion interface {
937+
ImplementsZeroTrustDLPEmailRuleBulkEditResponseConditionsValueUnion()
938+
}
939+
940+
func init() {
941+
apijson.RegisterUnion(
942+
reflect.TypeOf((*DLPEmailRuleBulkEditResponseConditionsValueUnion)(nil)).Elem(),
943+
"",
944+
apijson.UnionVariant{
945+
TypeFilter: gjson.JSON,
946+
Type: reflect.TypeOf(DLPEmailRuleBulkEditResponseConditionsValueArray{}),
947+
},
948+
apijson.UnionVariant{
949+
TypeFilter: gjson.String,
950+
Type: reflect.TypeOf(shared.UnionString("")),
951+
},
952+
)
953+
}
954+
955+
type DLPEmailRuleBulkEditResponseConditionsValueArray []string
956+
957+
func (r DLPEmailRuleBulkEditResponseConditionsValueArray) ImplementsZeroTrustDLPEmailRuleBulkEditResponseConditionsValueUnion() {
958+
}
959+
828960
type DLPEmailRuleGetResponse struct {
829961
Action DLPEmailRuleGetResponseAction `json:"action,required"`
830962
// Rule is triggered if all conditions match
@@ -901,10 +1033,10 @@ func (r DLPEmailRuleGetResponseActionAction) IsKnown() bool {
9011033
}
9021034

9031035
type DLPEmailRuleGetResponseCondition struct {
904-
Operator DLPEmailRuleGetResponseConditionsOperator `json:"operator,required"`
905-
Selector DLPEmailRuleGetResponseConditionsSelector `json:"selector,required"`
906-
Value interface{} `json:"value,required"`
907-
JSON dlpEmailRuleGetResponseConditionJSON `json:"-"`
1036+
Operator DLPEmailRuleGetResponseConditionsOperator `json:"operator,required"`
1037+
Selector DLPEmailRuleGetResponseConditionsSelector `json:"selector,required"`
1038+
Value DLPEmailRuleGetResponseConditionsValueUnion `json:"value,required"`
1039+
JSON dlpEmailRuleGetResponseConditionJSON `json:"-"`
9081040
}
9091041

9101042
// dlpEmailRuleGetResponseConditionJSON contains the JSON metadata for the struct
@@ -958,6 +1090,32 @@ func (r DLPEmailRuleGetResponseConditionsSelector) IsKnown() bool {
9581090
return false
9591091
}
9601092

1093+
// Union satisfied by [zero_trust.DLPEmailRuleGetResponseConditionsValueArray] or
1094+
// [shared.UnionString].
1095+
type DLPEmailRuleGetResponseConditionsValueUnion interface {
1096+
ImplementsZeroTrustDLPEmailRuleGetResponseConditionsValueUnion()
1097+
}
1098+
1099+
func init() {
1100+
apijson.RegisterUnion(
1101+
reflect.TypeOf((*DLPEmailRuleGetResponseConditionsValueUnion)(nil)).Elem(),
1102+
"",
1103+
apijson.UnionVariant{
1104+
TypeFilter: gjson.JSON,
1105+
Type: reflect.TypeOf(DLPEmailRuleGetResponseConditionsValueArray{}),
1106+
},
1107+
apijson.UnionVariant{
1108+
TypeFilter: gjson.String,
1109+
Type: reflect.TypeOf(shared.UnionString("")),
1110+
},
1111+
)
1112+
}
1113+
1114+
type DLPEmailRuleGetResponseConditionsValueArray []string
1115+
1116+
func (r DLPEmailRuleGetResponseConditionsValueArray) ImplementsZeroTrustDLPEmailRuleGetResponseConditionsValueUnion() {
1117+
}
1118+
9611119
type DLPEmailRuleNewParams struct {
9621120
AccountID param.Field[string] `path:"account_id,required"`
9631121
Action param.Field[DLPEmailRuleNewParamsAction] `json:"action,required"`
@@ -996,9 +1154,9 @@ func (r DLPEmailRuleNewParamsActionAction) IsKnown() bool {
9961154
}
9971155

9981156
type DLPEmailRuleNewParamsCondition struct {
999-
Operator param.Field[DLPEmailRuleNewParamsConditionsOperator] `json:"operator,required"`
1000-
Selector param.Field[DLPEmailRuleNewParamsConditionsSelector] `json:"selector,required"`
1001-
Value param.Field[interface{}] `json:"value,required"`
1157+
Operator param.Field[DLPEmailRuleNewParamsConditionsOperator] `json:"operator,required"`
1158+
Selector param.Field[DLPEmailRuleNewParamsConditionsSelector] `json:"selector,required"`
1159+
Value param.Field[DLPEmailRuleNewParamsConditionsValueUnion] `json:"value,required"`
10021160
}
10031161

10041162
func (r DLPEmailRuleNewParamsCondition) MarshalJSON() (data []byte, err error) {
@@ -1038,6 +1196,17 @@ func (r DLPEmailRuleNewParamsConditionsSelector) IsKnown() bool {
10381196
return false
10391197
}
10401198

1199+
// Satisfied by [zero_trust.DLPEmailRuleNewParamsConditionsValueArray],
1200+
// [shared.UnionString].
1201+
type DLPEmailRuleNewParamsConditionsValueUnion interface {
1202+
ImplementsZeroTrustDLPEmailRuleNewParamsConditionsValueUnion()
1203+
}
1204+
1205+
type DLPEmailRuleNewParamsConditionsValueArray []string
1206+
1207+
func (r DLPEmailRuleNewParamsConditionsValueArray) ImplementsZeroTrustDLPEmailRuleNewParamsConditionsValueUnion() {
1208+
}
1209+
10411210
type DLPEmailRuleNewResponseEnvelope struct {
10421211
Errors []shared.ResponseInfo `json:"errors,required"`
10431212
Messages []shared.ResponseInfo `json:"messages,required"`
@@ -1119,9 +1288,9 @@ func (r DLPEmailRuleUpdateParamsActionAction) IsKnown() bool {
11191288
}
11201289

11211290
type DLPEmailRuleUpdateParamsCondition struct {
1122-
Operator param.Field[DLPEmailRuleUpdateParamsConditionsOperator] `json:"operator,required"`
1123-
Selector param.Field[DLPEmailRuleUpdateParamsConditionsSelector] `json:"selector,required"`
1124-
Value param.Field[interface{}] `json:"value,required"`
1291+
Operator param.Field[DLPEmailRuleUpdateParamsConditionsOperator] `json:"operator,required"`
1292+
Selector param.Field[DLPEmailRuleUpdateParamsConditionsSelector] `json:"selector,required"`
1293+
Value param.Field[DLPEmailRuleUpdateParamsConditionsValueUnion] `json:"value,required"`
11251294
}
11261295

11271296
func (r DLPEmailRuleUpdateParamsCondition) MarshalJSON() (data []byte, err error) {
@@ -1161,6 +1330,17 @@ func (r DLPEmailRuleUpdateParamsConditionsSelector) IsKnown() bool {
11611330
return false
11621331
}
11631332

1333+
// Satisfied by [zero_trust.DLPEmailRuleUpdateParamsConditionsValueArray],
1334+
// [shared.UnionString].
1335+
type DLPEmailRuleUpdateParamsConditionsValueUnion interface {
1336+
ImplementsZeroTrustDLPEmailRuleUpdateParamsConditionsValueUnion()
1337+
}
1338+
1339+
type DLPEmailRuleUpdateParamsConditionsValueArray []string
1340+
1341+
func (r DLPEmailRuleUpdateParamsConditionsValueArray) ImplementsZeroTrustDLPEmailRuleUpdateParamsConditionsValueUnion() {
1342+
}
1343+
11641344
type DLPEmailRuleUpdateResponseEnvelope struct {
11651345
Errors []shared.ResponseInfo `json:"errors,required"`
11661346
Messages []shared.ResponseInfo `json:"messages,required"`

‎zero_trust/dlpemailrule_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestDLPEmailRuleNewWithOptionalParams(t *testing.T) {
3636
Conditions: cloudflare.F([]zero_trust.DLPEmailRuleNewParamsCondition{{
3737
Operator: cloudflare.F(zero_trust.DLPEmailRuleNewParamsConditionsOperatorInList),
3838
Selector: cloudflare.F(zero_trust.DLPEmailRuleNewParamsConditionsSelectorRecipients),
39-
Value: cloudflare.F[any](map[string]interface{}{}),
39+
Value: cloudflare.F[zero_trust.DLPEmailRuleNewParamsConditionsValueUnion](zero_trust.DLPEmailRuleNewParamsConditionsValueArray([]string{"string"})),
4040
}}),
4141
Enabled: cloudflare.F(true),
4242
Name: cloudflare.F("name"),
@@ -76,7 +76,7 @@ func TestDLPEmailRuleUpdateWithOptionalParams(t *testing.T) {
7676
Conditions: cloudflare.F([]zero_trust.DLPEmailRuleUpdateParamsCondition{{
7777
Operator: cloudflare.F(zero_trust.DLPEmailRuleUpdateParamsConditionsOperatorInList),
7878
Selector: cloudflare.F(zero_trust.DLPEmailRuleUpdateParamsConditionsSelectorRecipients),
79-
Value: cloudflare.F[any](map[string]interface{}{}),
79+
Value: cloudflare.F[zero_trust.DLPEmailRuleUpdateParamsConditionsValueUnion](zero_trust.DLPEmailRuleUpdateParamsConditionsValueArray([]string{"string"})),
8080
}}),
8181
Enabled: cloudflare.F(true),
8282
Name: cloudflare.F("name"),

0 commit comments

Comments
 (0)
Please sign in to comment.