Skip to content

Commit e4231aa

Browse files
feat(api): fix account ID types
Change type of account_id path parameter from 'number' to 'string' for Cloudforce threat event and Magic Transit connector endpoints
1 parent d481ce3 commit e4231aa

37 files changed

+162
-162
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1752
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-630f05355fbbcf8b9ce657a1a5635aab2423b8387a5ffa7534173ffcdf57a305.yml
3-
openapi_spec_hash: ca3793864d354c1d505730523406f865
4-
config_hash: 135c41c52147f104907327e028f831e2
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-dc675acbdcab1131f3681a184a8515deca17471c93595473e2474c4b5fafc7e2.yml
3+
openapi_spec_hash: 41b14e228d5ef99f8e1e09732ce2679c
4+
config_hash: 22b6cc50203041358f4b2b4e832b009d

cloudforce_one/threatevent.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ func NewThreatEventService(opts ...option.RequestOption) (r *ThreatEventService)
6666
// endpoint.
6767
func (r *ThreatEventService) New(ctx context.Context, params ThreatEventNewParams, opts ...option.RequestOption) (res *ThreatEventNewResponse, err error) {
6868
opts = append(r.Options[:], opts...)
69-
if !params.PathAccountID.Present {
69+
if params.PathAccountID.Value == "" {
7070
err = errors.New("missing required account_id parameter")
7171
return
7272
}
73-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/create", params.PathAccountID)
73+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/create", params.PathAccountID)
7474
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
7575
return
7676
}
@@ -81,11 +81,11 @@ func (r *ThreatEventService) New(ctx context.Context, params ThreatEventNewParam
8181
// endpoint). Also, must provide query parameters.
8282
func (r *ThreatEventService) List(ctx context.Context, params ThreatEventListParams, opts ...option.RequestOption) (res *[]ThreatEventListResponse, err error) {
8383
opts = append(r.Options[:], opts...)
84-
if !params.AccountID.Present {
84+
if params.AccountID.Value == "" {
8585
err = errors.New("missing required account_id parameter")
8686
return
8787
}
88-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events", params.AccountID)
88+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events", params.AccountID)
8989
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &res, opts...)
9090
return
9191
}
@@ -96,15 +96,15 @@ func (r *ThreatEventService) List(ctx context.Context, params ThreatEventListPar
9696
// endpoint.
9797
func (r *ThreatEventService) Delete(ctx context.Context, eventID string, body ThreatEventDeleteParams, opts ...option.RequestOption) (res *ThreatEventDeleteResponse, err error) {
9898
opts = append(r.Options[:], opts...)
99-
if !body.AccountID.Present {
99+
if body.AccountID.Value == "" {
100100
err = errors.New("missing required account_id parameter")
101101
return
102102
}
103103
if eventID == "" {
104104
err = errors.New("missing required event_id parameter")
105105
return
106106
}
107-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/%s", body.AccountID, eventID)
107+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/%s", body.AccountID, eventID)
108108
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
109109
return
110110
}
@@ -115,43 +115,43 @@ func (r *ThreatEventService) Delete(ctx context.Context, eventID string, body Th
115115
// endpoint.
116116
func (r *ThreatEventService) BulkNew(ctx context.Context, params ThreatEventBulkNewParams, opts ...option.RequestOption) (res *[]ThreatEventBulkNewResponse, err error) {
117117
opts = append(r.Options[:], opts...)
118-
if !params.AccountID.Present {
118+
if params.AccountID.Value == "" {
119119
err = errors.New("missing required account_id parameter")
120120
return
121121
}
122-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/create/bulk", params.AccountID)
122+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/create/bulk", params.AccountID)
123123
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
124124
return
125125
}
126126

127127
// Updates an event
128128
func (r *ThreatEventService) Edit(ctx context.Context, eventID string, params ThreatEventEditParams, opts ...option.RequestOption) (res *ThreatEventEditResponse, err error) {
129129
opts = append(r.Options[:], opts...)
130-
if !params.AccountID.Present {
130+
if params.AccountID.Value == "" {
131131
err = errors.New("missing required account_id parameter")
132132
return
133133
}
134134
if eventID == "" {
135135
err = errors.New("missing required event_id parameter")
136136
return
137137
}
138-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/%s", params.AccountID, eventID)
138+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/%s", params.AccountID, eventID)
139139
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &res, opts...)
140140
return
141141
}
142142

143143
// Reads an event
144144
func (r *ThreatEventService) Get(ctx context.Context, eventID string, query ThreatEventGetParams, opts ...option.RequestOption) (res *ThreatEventGetResponse, err error) {
145145
opts = append(r.Options[:], opts...)
146-
if !query.AccountID.Present {
146+
if query.AccountID.Value == "" {
147147
err = errors.New("missing required account_id parameter")
148148
return
149149
}
150150
if eventID == "" {
151151
err = errors.New("missing required event_id parameter")
152152
return
153153
}
154-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/%s", query.AccountID, eventID)
154+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/%s", query.AccountID, eventID)
155155
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
156156
return
157157
}
@@ -544,7 +544,7 @@ func (r threatEventGetResponseJSON) RawJSON() string {
544544

545545
type ThreatEventNewParams struct {
546546
// Account ID.
547-
PathAccountID param.Field[float64] `path:"account_id,required"`
547+
PathAccountID param.Field[string] `path:"account_id,required"`
548548
Attacker param.Field[string] `json:"attacker,required"`
549549
AttackerCountry param.Field[string] `json:"attackerCountry,required"`
550550
Category param.Field[string] `json:"category,required"`
@@ -577,7 +577,7 @@ func (r ThreatEventNewParamsRaw) MarshalJSON() (data []byte, err error) {
577577

578578
type ThreatEventListParams struct {
579579
// Account ID.
580-
AccountID param.Field[float64] `path:"account_id,required"`
580+
AccountID param.Field[string] `path:"account_id,required"`
581581
DatasetID param.Field[[]string] `query:"datasetId"`
582582
ForceRefresh param.Field[bool] `query:"forceRefresh"`
583583
Order param.Field[ThreatEventListParamsOrder] `query:"order"`
@@ -667,12 +667,12 @@ type ThreatEventListParamsSearchValueArrayItemUnion interface {
667667

668668
type ThreatEventDeleteParams struct {
669669
// Account ID.
670-
AccountID param.Field[float64] `path:"account_id,required"`
670+
AccountID param.Field[string] `path:"account_id,required"`
671671
}
672672

673673
type ThreatEventBulkNewParams struct {
674674
// Account ID.
675-
AccountID param.Field[float64] `path:"account_id,required"`
675+
AccountID param.Field[string] `path:"account_id,required"`
676676
Data param.Field[[]ThreatEventBulkNewParamsData] `json:"data,required"`
677677
DatasetID param.Field[string] `json:"datasetId,required"`
678678
}
@@ -714,7 +714,7 @@ func (r ThreatEventBulkNewParamsDataRaw) MarshalJSON() (data []byte, err error)
714714

715715
type ThreatEventEditParams struct {
716716
// Account ID.
717-
AccountID param.Field[float64] `path:"account_id,required"`
717+
AccountID param.Field[string] `path:"account_id,required"`
718718
Attacker param.Field[string] `json:"attacker"`
719719
AttackerCountry param.Field[string] `json:"attackerCountry"`
720720
Category param.Field[string] `json:"category"`
@@ -733,5 +733,5 @@ func (r ThreatEventEditParams) MarshalJSON() (data []byte, err error) {
733733

734734
type ThreatEventGetParams struct {
735735
// Account ID.
736-
AccountID param.Field[float64] `path:"account_id,required"`
736+
AccountID param.Field[string] `path:"account_id,required"`
737737
}

cloudforce_one/threatevent_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestThreatEventNewWithOptionalParams(t *testing.T) {
3131
option.WithAPIEmail("user@example.com"),
3232
)
3333
_, err := client.CloudforceOne.ThreatEvents.New(context.TODO(), cloudforce_one.ThreatEventNewParams{
34-
PathAccountID: cloudflare.F(0.000000),
34+
PathAccountID: cloudflare.F("account_id"),
3535
Attacker: cloudflare.F("Flying Yeti"),
3636
AttackerCountry: cloudflare.F("CN"),
3737
Category: cloudflare.F("Domain Resolution"),
@@ -77,7 +77,7 @@ func TestThreatEventListWithOptionalParams(t *testing.T) {
7777
option.WithAPIEmail("user@example.com"),
7878
)
7979
_, err := client.CloudforceOne.ThreatEvents.List(context.TODO(), cloudforce_one.ThreatEventListParams{
80-
AccountID: cloudflare.F(0.000000),
80+
AccountID: cloudflare.F("account_id"),
8181
DatasetID: cloudflare.F([]string{"string"}),
8282
ForceRefresh: cloudflare.F(true),
8383
Order: cloudflare.F(cloudforce_one.ThreatEventListParamsOrderAsc),
@@ -117,7 +117,7 @@ func TestThreatEventDelete(t *testing.T) {
117117
context.TODO(),
118118
"event_id",
119119
cloudforce_one.ThreatEventDeleteParams{
120-
AccountID: cloudflare.F(0.000000),
120+
AccountID: cloudflare.F("account_id"),
121121
},
122122
)
123123
if err != nil {
@@ -144,7 +144,7 @@ func TestThreatEventBulkNew(t *testing.T) {
144144
option.WithAPIEmail("user@example.com"),
145145
)
146146
_, err := client.CloudforceOne.ThreatEvents.BulkNew(context.TODO(), cloudforce_one.ThreatEventBulkNewParams{
147-
AccountID: cloudflare.F(0.000000),
147+
AccountID: cloudflare.F("account_id"),
148148
Data: cloudflare.F([]cloudforce_one.ThreatEventBulkNewParamsData{{
149149
Attacker: cloudflare.F("Flying Yeti"),
150150
AttackerCountry: cloudflare.F("CN"),
@@ -196,7 +196,7 @@ func TestThreatEventEditWithOptionalParams(t *testing.T) {
196196
context.TODO(),
197197
"event_id",
198198
cloudforce_one.ThreatEventEditParams{
199-
AccountID: cloudflare.F(0.000000),
199+
AccountID: cloudflare.F("account_id"),
200200
Attacker: cloudflare.F("Flying Yeti"),
201201
AttackerCountry: cloudflare.F("CN"),
202202
Category: cloudflare.F("Domain Resolution"),
@@ -236,7 +236,7 @@ func TestThreatEventGet(t *testing.T) {
236236
context.TODO(),
237237
"event_id",
238238
cloudforce_one.ThreatEventGetParams{
239-
AccountID: cloudflare.F(0.000000),
239+
AccountID: cloudflare.F("account_id"),
240240
},
241241
)
242242
if err != nil {

cloudforce_one/threateventattacker.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ func NewThreatEventAttackerService(opts ...option.RequestOption) (r *ThreatEvent
3636
// Lists attackers
3737
func (r *ThreatEventAttackerService) List(ctx context.Context, query ThreatEventAttackerListParams, opts ...option.RequestOption) (res *ThreatEventAttackerListResponse, err error) {
3838
opts = append(r.Options[:], opts...)
39-
if !query.AccountID.Present {
39+
if query.AccountID.Value == "" {
4040
err = errors.New("missing required account_id parameter")
4141
return
4242
}
43-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/attackers", query.AccountID)
43+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/attackers", query.AccountID)
4444
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
4545
return
4646
}
@@ -91,5 +91,5 @@ func (r threatEventAttackerListResponseItemsJSON) RawJSON() string {
9191

9292
type ThreatEventAttackerListParams struct {
9393
// Account ID.
94-
AccountID param.Field[float64] `path:"account_id,required"`
94+
AccountID param.Field[string] `path:"account_id,required"`
9595
}

cloudforce_one/threateventattacker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestThreatEventAttackerList(t *testing.T) {
2929
option.WithAPIEmail("user@example.com"),
3030
)
3131
_, err := client.CloudforceOne.ThreatEvents.Attackers.List(context.TODO(), cloudforce_one.ThreatEventAttackerListParams{
32-
AccountID: cloudflare.F(0.000000),
32+
AccountID: cloudflare.F("account_id"),
3333
})
3434
if err != nil {
3535
var apierr *cloudflare.Error

cloudforce_one/threateventcategory.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,71 +36,71 @@ func NewThreatEventCategoryService(opts ...option.RequestOption) (r *ThreatEvent
3636
// Creates a new category
3737
func (r *ThreatEventCategoryService) New(ctx context.Context, params ThreatEventCategoryNewParams, opts ...option.RequestOption) (res *ThreatEventCategoryNewResponse, err error) {
3838
opts = append(r.Options[:], opts...)
39-
if !params.AccountID.Present {
39+
if params.AccountID.Value == "" {
4040
err = errors.New("missing required account_id parameter")
4141
return
4242
}
43-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/categories/create", params.AccountID)
43+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/categories/create", params.AccountID)
4444
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
4545
return
4646
}
4747

4848
// Lists categories
4949
func (r *ThreatEventCategoryService) List(ctx context.Context, query ThreatEventCategoryListParams, opts ...option.RequestOption) (res *[]ThreatEventCategoryListResponse, err error) {
5050
opts = append(r.Options[:], opts...)
51-
if !query.AccountID.Present {
51+
if query.AccountID.Value == "" {
5252
err = errors.New("missing required account_id parameter")
5353
return
5454
}
55-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/categories", query.AccountID)
55+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/categories", query.AccountID)
5656
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
5757
return
5858
}
5959

6060
// Deletes a category
6161
func (r *ThreatEventCategoryService) Delete(ctx context.Context, categoryID string, body ThreatEventCategoryDeleteParams, opts ...option.RequestOption) (res *ThreatEventCategoryDeleteResponse, err error) {
6262
opts = append(r.Options[:], opts...)
63-
if !body.AccountID.Present {
63+
if body.AccountID.Value == "" {
6464
err = errors.New("missing required account_id parameter")
6565
return
6666
}
6767
if categoryID == "" {
6868
err = errors.New("missing required category_id parameter")
6969
return
7070
}
71-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/categories/%s", body.AccountID, categoryID)
71+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/categories/%s", body.AccountID, categoryID)
7272
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
7373
return
7474
}
7575

7676
// Updates a category
7777
func (r *ThreatEventCategoryService) Edit(ctx context.Context, categoryID string, params ThreatEventCategoryEditParams, opts ...option.RequestOption) (res *ThreatEventCategoryEditResponse, err error) {
7878
opts = append(r.Options[:], opts...)
79-
if !params.AccountID.Present {
79+
if params.AccountID.Value == "" {
8080
err = errors.New("missing required account_id parameter")
8181
return
8282
}
8383
if categoryID == "" {
8484
err = errors.New("missing required category_id parameter")
8585
return
8686
}
87-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/categories/%s", params.AccountID, categoryID)
87+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/categories/%s", params.AccountID, categoryID)
8888
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &res, opts...)
8989
return
9090
}
9191

9292
// Reads a category
9393
func (r *ThreatEventCategoryService) Get(ctx context.Context, categoryID string, query ThreatEventCategoryGetParams, opts ...option.RequestOption) (res *ThreatEventCategoryGetResponse, err error) {
9494
opts = append(r.Options[:], opts...)
95-
if !query.AccountID.Present {
95+
if query.AccountID.Value == "" {
9696
err = errors.New("missing required account_id parameter")
9797
return
9898
}
9999
if categoryID == "" {
100100
err = errors.New("missing required category_id parameter")
101101
return
102102
}
103-
path := fmt.Sprintf("accounts/%v/cloudforce-one/events/categories/%s", query.AccountID, categoryID)
103+
path := fmt.Sprintf("accounts/%s/cloudforce-one/events/categories/%s", query.AccountID, categoryID)
104104
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
105105
return
106106
}
@@ -244,7 +244,7 @@ func (r threatEventCategoryGetResponseJSON) RawJSON() string {
244244

245245
type ThreatEventCategoryNewParams struct {
246246
// Account ID.
247-
AccountID param.Field[float64] `path:"account_id,required"`
247+
AccountID param.Field[string] `path:"account_id,required"`
248248
KillChain param.Field[float64] `json:"killChain,required"`
249249
Name param.Field[string] `json:"name,required"`
250250
MitreAttack param.Field[[]string] `json:"mitreAttack"`
@@ -257,17 +257,17 @@ func (r ThreatEventCategoryNewParams) MarshalJSON() (data []byte, err error) {
257257

258258
type ThreatEventCategoryListParams struct {
259259
// Account ID.
260-
AccountID param.Field[float64] `path:"account_id,required"`
260+
AccountID param.Field[string] `path:"account_id,required"`
261261
}
262262

263263
type ThreatEventCategoryDeleteParams struct {
264264
// Account ID.
265-
AccountID param.Field[float64] `path:"account_id,required"`
265+
AccountID param.Field[string] `path:"account_id,required"`
266266
}
267267

268268
type ThreatEventCategoryEditParams struct {
269269
// Account ID.
270-
AccountID param.Field[float64] `path:"account_id,required"`
270+
AccountID param.Field[string] `path:"account_id,required"`
271271
KillChain param.Field[float64] `json:"killChain"`
272272
MitreAttack param.Field[[]string] `json:"mitreAttack"`
273273
Name param.Field[string] `json:"name"`
@@ -280,5 +280,5 @@ func (r ThreatEventCategoryEditParams) MarshalJSON() (data []byte, err error) {
280280

281281
type ThreatEventCategoryGetParams struct {
282282
// Account ID.
283-
AccountID param.Field[float64] `path:"account_id,required"`
283+
AccountID param.Field[string] `path:"account_id,required"`
284284
}

0 commit comments

Comments
 (0)