Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): OpenAPI spec update via Stainless API #3219

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1342
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9f6561357b4e1771455d4e7524bed0826ab9a169a679fe7c095dce93a743354e.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f8773718ab097ba127ddff8348a6c33fb796bffc55b0e7e3ac0eee0124d64cda.yml
17 changes: 15 additions & 2 deletions magic_network_monitoring/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,19 @@ type ConfigurationWARPDevice struct {
// Unique identifier for the warp device.
ID string `json:"id,required"`
// Name of the warp device.
Name string `json:"name,required"`
JSON configurationWARPDeviceJSON `json:"-"`
Name string `json:"name,required"`
// IPv4 CIDR of the router sourcing flow data associated with this warp device.
// Only /32 addresses are currently supported.
RouterIP string `json:"router_ip,required"`
JSON configurationWARPDeviceJSON `json:"-"`
}

// configurationWARPDeviceJSON contains the JSON metadata for the struct
// [ConfigurationWARPDevice]
type configurationWARPDeviceJSON struct {
ID apijson.Field
Name apijson.Field
RouterIP apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -198,6 +202,9 @@ type ConfigNewParamsWARPDevice struct {
ID param.Field[string] `json:"id,required"`
// Name of the warp device.
Name param.Field[string] `json:"name,required"`
// IPv4 CIDR of the router sourcing flow data associated with this warp device.
// Only /32 addresses are currently supported.
RouterIP param.Field[string] `json:"router_ip,required"`
}

func (r ConfigNewParamsWARPDevice) MarshalJSON() (data []byte, err error) {
Expand Down Expand Up @@ -268,6 +275,9 @@ type ConfigUpdateParamsWARPDevice struct {
ID param.Field[string] `json:"id,required"`
// Name of the warp device.
Name param.Field[string] `json:"name,required"`
// IPv4 CIDR of the router sourcing flow data associated with this warp device.
// Only /32 addresses are currently supported.
RouterIP param.Field[string] `json:"router_ip,required"`
}

func (r ConfigUpdateParamsWARPDevice) MarshalJSON() (data []byte, err error) {
Expand Down Expand Up @@ -385,6 +395,9 @@ type ConfigEditParamsWARPDevice struct {
ID param.Field[string] `json:"id,required"`
// Name of the warp device.
Name param.Field[string] `json:"name,required"`
// IPv4 CIDR of the router sourcing flow data associated with this warp device.
// Only /32 addresses are currently supported.
RouterIP param.Field[string] `json:"router_ip,required"`
}

func (r ConfigEditParamsWARPDevice) MarshalJSON() (data []byte, err error) {
Expand Down
51 changes: 30 additions & 21 deletions magic_network_monitoring/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ func TestConfigNewWithOptionalParams(t *testing.T) {
AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"),
DefaultSampling: cloudflare.F(1.000000),
Name: cloudflare.F("cloudflare user's account"),
RouterIPs: cloudflare.F([]string{"203.0.113.1/32", "203.0.113.1/32", "203.0.113.1/32"}),
RouterIPs: cloudflare.F([]string{"203.0.113.1", "203.0.113.1", "203.0.113.1"}),
WARPDevices: cloudflare.F([]magic_network_monitoring.ConfigNewParamsWARPDevice{{
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}, {
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}, {
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}}),
})
if err != nil {
Expand Down Expand Up @@ -69,16 +72,19 @@ func TestConfigUpdateWithOptionalParams(t *testing.T) {
AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"),
DefaultSampling: cloudflare.F(1.000000),
Name: cloudflare.F("cloudflare user's account"),
RouterIPs: cloudflare.F([]string{"203.0.113.1/32", "203.0.113.1/32", "203.0.113.1/32"}),
RouterIPs: cloudflare.F([]string{"203.0.113.1", "203.0.113.1", "203.0.113.1"}),
WARPDevices: cloudflare.F([]magic_network_monitoring.ConfigUpdateParamsWARPDevice{{
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}, {
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}, {
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}}),
})
if err != nil {
Expand Down Expand Up @@ -132,16 +138,19 @@ func TestConfigEditWithOptionalParams(t *testing.T) {
AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"),
DefaultSampling: cloudflare.F(1.000000),
Name: cloudflare.F("cloudflare user's account"),
RouterIPs: cloudflare.F([]string{"203.0.113.1/32", "203.0.113.1/32", "203.0.113.1/32"}),
RouterIPs: cloudflare.F([]string{"203.0.113.1", "203.0.113.1", "203.0.113.1"}),
WARPDevices: cloudflare.F([]magic_network_monitoring.ConfigEditParamsWARPDevice{{
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}, {
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}, {
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
ID: cloudflare.F("5360368d-b351-4791-abe1-93550dabd351"),
Name: cloudflare.F("My warp device"),
RouterIP: cloudflare.F("203.0.113.1"),
}}),
})
if err != nil {
Expand Down