Skip to content

Commit

Permalink
chore(internal): codegen related update (#3831)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 29, 2025
1 parent e55f566 commit ce219b7
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 93 deletions.
18 changes: 9 additions & 9 deletions accounts/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,15 @@ func TestTokenUpdateWithOptionalParams(t *testing.T) {
accounts.TokenUpdateParams{
AccountID: cloudflare.F("eb78d65290b24279ba6f44721b3ea3c4"),
Token: shared.TokenParam{
Name: cloudflare.F("readonly token"),
Condition: cloudflare.F(shared.TokenConditionParam{
RequestIP: cloudflare.F(shared.TokenConditionRequestIPParam{
In: cloudflare.F([]shared.TokenConditionCIDRListParam{"123.123.123.0/24", "2606:4700::/32"}),
NotIn: cloudflare.F([]shared.TokenConditionCIDRListParam{"123.123.123.100/24", "2606:4700:4700::/48"}),
}),
}),
ExpiresOn: cloudflare.F(time.Now()),
Name: cloudflare.F("readonly token"),
NotBefore: cloudflare.F(time.Now()),
Policies: cloudflare.F([]shared.TokenPolicyParam{{
Effect: cloudflare.F(shared.TokenPolicyEffectAllow),
PermissionGroups: cloudflare.F([]shared.TokenPolicyPermissionGroupParam{{
Expand All @@ -109,14 +117,6 @@ func TestTokenUpdateWithOptionalParams(t *testing.T) {
}),
}}),
Status: cloudflare.F(shared.TokenStatusActive),
Condition: cloudflare.F(shared.TokenConditionParam{
RequestIP: cloudflare.F(shared.TokenConditionRequestIPParam{
In: cloudflare.F([]shared.TokenConditionCIDRListParam{"123.123.123.0/24", "2606:4700::/32"}),
NotIn: cloudflare.F([]shared.TokenConditionCIDRListParam{"123.123.123.100/24", "2606:4700:4700::/48"}),
}),
}),
ExpiresOn: cloudflare.F(time.Now()),
NotBefore: cloudflare.F(time.Now()),
},
},
)
Expand Down
2 changes: 1 addition & 1 deletion content_scanning/payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestPayloadDelete(t *testing.T) {
)
_, err := client.ContentScanning.Payloads.Delete(
context.TODO(),
"a350a054caa840c9becd89c3b4f0195b",
"023e105f4ecef8ad9ca31a8372d0c353",
content_scanning.PayloadDeleteParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
Expand Down
4 changes: 2 additions & 2 deletions dns/settingview.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ type SettingViewNewParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
// The name of the view.
Name param.Field[string] `json:"name,required"`
Name param.Field[string] `json:"name"`
// The list of zones linked to this view.
Zones param.Field[[]string] `json:"zones,required"`
Zones param.Field[[]string] `json:"zones"`
}

func (r SettingViewNewParams) MarshalJSON() (data []byte, err error) {
Expand Down
2 changes: 1 addition & 1 deletion dns/settingview_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/cloudflare/cloudflare-go/v4/option"
)

func TestSettingViewNew(t *testing.T) {
func TestSettingViewNewWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
Expand Down
8 changes: 4 additions & 4 deletions dns_firewall/dnsfirewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,6 @@ func (r dnsFirewallGetResponseJSON) RawJSON() string {
type DNSFirewallNewParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
// DNS Firewall cluster name
Name param.Field[string] `json:"name,required"`
UpstreamIPs param.Field[[]UpstreamIPsParam] `json:"upstream_ips,required" format:"ipv4"`
// Attack mitigation settings
AttackMitigation param.Field[AttackMitigationParam] `json:"attack_mitigation"`
// Whether to refuse to answer queries for the ANY type
Expand All @@ -489,6 +486,8 @@ type DNSFirewallNewParams struct {
// of caching between DNS Firewall and the upstream servers. Lower TTLs will be
// increased to the minimum defined here for caching purposes.
MinimumCacheTTL param.Field[float64] `json:"minimum_cache_ttl"`
// DNS Firewall cluster name
Name param.Field[string] `json:"name"`
// Negative DNS cache TTL This setting controls how long DNS Firewall should cache
// negative responses (e.g., NXDOMAIN) from the upstream servers.
NegativeCacheTTL param.Field[float64] `json:"negative_cache_ttl"`
Expand All @@ -497,7 +496,8 @@ type DNSFirewallNewParams struct {
Ratelimit param.Field[float64] `json:"ratelimit"`
// Number of retries for fetching DNS responses from upstream nameservers (not
// counting the initial attempt)
Retries param.Field[float64] `json:"retries"`
Retries param.Field[float64] `json:"retries"`
UpstreamIPs param.Field[[]UpstreamIPsParam] `json:"upstream_ips" format:"ipv4"`
}

func (r DNSFirewallNewParams) MarshalJSON() (data []byte, err error) {
Expand Down
6 changes: 3 additions & 3 deletions dns_firewall/dnsfirewall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ func TestDNSFirewallNewWithOptionalParams(t *testing.T) {
option.WithAPIEmail("user@example.com"),
)
_, err := client.DNSFirewall.New(context.TODO(), dns_firewall.DNSFirewallNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Name: cloudflare.F("My Awesome DNS Firewall cluster"),
UpstreamIPs: cloudflare.F([]dns_firewall.UpstreamIPsParam{"192.0.2.1", "198.51.100.1", "string"}),
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
AttackMitigation: cloudflare.F(dns_firewall.AttackMitigationParam{
Enabled: cloudflare.F(true),
OnlyWhenUpstreamUnhealthy: cloudflare.F(false),
Expand All @@ -40,9 +38,11 @@ func TestDNSFirewallNewWithOptionalParams(t *testing.T) {
ECSFallback: cloudflare.F(false),
MaximumCacheTTL: cloudflare.F(900.000000),
MinimumCacheTTL: cloudflare.F(60.000000),
Name: cloudflare.F("My Awesome DNS Firewall cluster"),
NegativeCacheTTL: cloudflare.F(900.000000),
Ratelimit: cloudflare.F(600.000000),
Retries: cloudflare.F(2.000000),
UpstreamIPs: cloudflare.F([]dns_firewall.UpstreamIPsParam{"192.0.2.1", "198.51.100.1", "string"}),
})
if err != nil {
var apierr *cloudflare.Error
Expand Down
4 changes: 2 additions & 2 deletions dns_firewall/reversedns.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (r *ReverseDNSService) Get(ctx context.Context, dnsFirewallID string, query

type ReverseDNSEditResponse struct {
// Map of cluster IP addresses to PTR record contents
PTR map[string]string `json:"ptr,required"`
PTR map[string]string `json:"ptr"`
JSON reverseDNSEditResponseJSON `json:"-"`
}

Expand All @@ -100,7 +100,7 @@ func (r reverseDNSEditResponseJSON) RawJSON() string {

type ReverseDNSGetResponse struct {
// Map of cluster IP addresses to PTR record contents
PTR map[string]string `json:"ptr,required"`
PTR map[string]string `json:"ptr"`
JSON reverseDNSGetResponseJSON `json:"-"`
}

Expand Down
4 changes: 2 additions & 2 deletions leaked_credential_checks/detection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestDetectionUpdateWithOptionalParams(t *testing.T) {
)
_, err := client.LeakedCredentialChecks.Detections.Update(
context.TODO(),
"18a14bafaa8eb1df04ce683ec18c765e",
"023e105f4ecef8ad9ca31a8372d0c353",
leaked_credential_checks.DetectionUpdateParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Password: cloudflare.F("lookup_json_string(http.request.body.raw, \"secret\")"),
Expand Down Expand Up @@ -112,7 +112,7 @@ func TestDetectionDelete(t *testing.T) {
)
_, err := client.LeakedCredentialChecks.Detections.Delete(
context.TODO(),
"18a14bafaa8eb1df04ce683ec18c765e",
"023e105f4ecef8ad9ca31a8372d0c353",
leaked_credential_checks.DetectionDeleteParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
Expand Down
2 changes: 1 addition & 1 deletion magic_transit/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestAppNewWithOptionalParams(t *testing.T) {
Name: cloudflare.F("Cloudflare Dashboard"),
Type: cloudflare.F("Development"),
Hostnames: cloudflare.F([]string{"auth.cloudflare.com"}),
IPSubnets: cloudflare.F([]string{"1.1.1.1/32"}),
IPSubnets: cloudflare.F([]string{"192.0.2.0/24"}),
})
if err != nil {
var apierr *cloudflare.Error
Expand Down
12 changes: 2 additions & 10 deletions pages/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,8 @@ func TestProjectEditWithOptionalParams(t *testing.T) {
},
}),
EnvVars: cloudflare.F(map[string]pages.ProjectDeploymentConfigsProductionEnvVarParam{
"BUILD_VERSION": {
Value: cloudflare.F("3.3"),
Type: cloudflare.F(pages.ProjectDeploymentConfigsProductionEnvVarsTypePlainText),
},
"delete_this_env_var": {
Value: cloudflare.F("value"),
Type: cloudflare.F(pages.ProjectDeploymentConfigsProductionEnvVarsTypePlainText),
},
"secret_var": {
Value: cloudflare.F("A_CMS_API_TOKEN"),
"foo": {
Value: cloudflare.F("hello world"),
Type: cloudflare.F(pages.ProjectDeploymentConfigsProductionEnvVarsTypePlainText),
},
}),
Expand Down
8 changes: 2 additions & 6 deletions spectrum/analyticseventbytime.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,10 @@ type AnalyticsEventBytimeGetParams struct {
// | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds |
// | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. |
Metrics param.Field[[]AnalyticsEventBytimeGetParamsMetric] `query:"metrics"`
// Start of time interval to query, defaults to `until` - 6 hours. Timestamp must
// be in RFC3339 format and uses UTC unless otherwise specified.
Since param.Field[time.Time] `query:"since" format:"date-time"`
Since param.Field[time.Time] `query:"since" format:"date-time"`
// The sort order for the result set; sort fields must be included in `metrics` or
// `dimensions`.
Sort param.Field[[]string] `query:"sort"`
// End of time interval to query, defaults to current time. Timestamp must be in
// RFC3339 format and uses UTC unless otherwise specified.
Sort param.Field[[]string] `query:"sort"`
Until param.Field[time.Time] `query:"until" format:"date-time"`
}

Expand Down
8 changes: 2 additions & 6 deletions spectrum/analyticseventsummary.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,10 @@ type AnalyticsEventSummaryGetParams struct {
// | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds |
// | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. |
Metrics param.Field[[]AnalyticsEventSummaryGetParamsMetric] `query:"metrics"`
// Start of time interval to query, defaults to `until` - 6 hours. Timestamp must
// be in RFC3339 format and uses UTC unless otherwise specified.
Since param.Field[time.Time] `query:"since" format:"date-time"`
Since param.Field[time.Time] `query:"since" format:"date-time"`
// The sort order for the result set; sort fields must be included in `metrics` or
// `dimensions`.
Sort param.Field[[]string] `query:"sort"`
// End of time interval to query, defaults to current time. Timestamp must be in
// RFC3339 format and uses UTC unless otherwise specified.
Sort param.Field[[]string] `query:"sort"`
Until param.Field[time.Time] `query:"until" format:"date-time"`
}

Expand Down
38 changes: 18 additions & 20 deletions spectrum/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,11 @@ func (r AppNewResponseSpectrumConfigAppConfigTrafficType) IsKnown() bool {
}

type AppNewResponseSpectrumConfigPaygoAppConfig struct {
// App identifier.
ID string `json:"id,required"`
// When the Application was created.
// Identifier
ID string `json:"id,required"`
CreatedOn time.Time `json:"created_on,required" format:"date-time"`
// The name and type of DNS record for the Spectrum application.
DNS DNS `json:"dns,required"`
// When the Application was last modified.
DNS DNS `json:"dns,required"`
ModifiedOn time.Time `json:"modified_on,required" format:"date-time"`
// The port configuration at Cloudflare's edge. May specify a single port, for
// example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.
Expand Down Expand Up @@ -750,13 +748,11 @@ func (r AppUpdateResponseSpectrumConfigAppConfigTrafficType) IsKnown() bool {
}

type AppUpdateResponseSpectrumConfigPaygoAppConfig struct {
// App identifier.
ID string `json:"id,required"`
// When the Application was created.
// Identifier
ID string `json:"id,required"`
CreatedOn time.Time `json:"created_on,required" format:"date-time"`
// The name and type of DNS record for the Spectrum application.
DNS DNS `json:"dns,required"`
// When the Application was last modified.
DNS DNS `json:"dns,required"`
ModifiedOn time.Time `json:"modified_on,required" format:"date-time"`
// The port configuration at Cloudflare's edge. May specify a single port, for
// example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.
Expand Down Expand Up @@ -1283,13 +1279,11 @@ func (r AppGetResponseSpectrumConfigAppConfigTrafficType) IsKnown() bool {
}

type AppGetResponseSpectrumConfigPaygoAppConfig struct {
// App identifier.
ID string `json:"id,required"`
// When the Application was created.
// Identifier
ID string `json:"id,required"`
CreatedOn time.Time `json:"created_on,required" format:"date-time"`
// The name and type of DNS record for the Spectrum application.
DNS DNS `json:"dns,required"`
// When the Application was last modified.
DNS DNS `json:"dns,required"`
ModifiedOn time.Time `json:"modified_on,required" format:"date-time"`
// The port configuration at Cloudflare's edge. May specify a single port, for
// example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.
Expand Down Expand Up @@ -1384,7 +1378,7 @@ func (r AppGetResponseTrafficType) IsKnown() bool {
}

type AppNewParams struct {
// Zone identifier.
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
Body AppNewParamsBodyUnion `json:"body,required"`
}
Expand Down Expand Up @@ -1550,6 +1544,8 @@ func (r AppNewParamsBodySpectrumConfigAppConfigTrafficType) IsKnown() bool {
}

type AppNewParamsBodySpectrumConfigPaygoAppConfig struct {
// Identifier
ID param.Field[string] `json:"id,required"`
// The name and type of DNS record for the Spectrum application.
DNS param.Field[DNSParam] `json:"dns,required"`
// The port configuration at Cloudflare's edge. May specify a single port, for
Expand Down Expand Up @@ -1670,7 +1666,7 @@ func (r AppNewResponseEnvelopeSuccess) IsKnown() bool {
}

type AppUpdateParams struct {
// Zone identifier.
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
Body AppUpdateParamsBodyUnion `json:"body,required"`
}
Expand Down Expand Up @@ -1837,6 +1833,8 @@ func (r AppUpdateParamsBodySpectrumConfigAppConfigTrafficType) IsKnown() bool {
}

type AppUpdateParamsBodySpectrumConfigPaygoAppConfig struct {
// Identifier
ID param.Field[string] `json:"id,required"`
// The name and type of DNS record for the Spectrum application.
DNS param.Field[DNSParam] `json:"dns,required"`
// The port configuration at Cloudflare's edge. May specify a single port, for
Expand Down Expand Up @@ -1958,7 +1956,7 @@ func (r AppUpdateResponseEnvelopeSuccess) IsKnown() bool {
}

type AppListParams struct {
// Zone identifier.
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
// Sets the direction by which results are ordered.
Direction param.Field[AppListParamsDirection] `query:"direction"`
Expand Down Expand Up @@ -2016,7 +2014,7 @@ func (r AppListParamsOrder) IsKnown() bool {
}

type AppDeleteParams struct {
// Zone identifier.
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
}

Expand Down Expand Up @@ -2064,7 +2062,7 @@ func (r AppDeleteResponseEnvelopeSuccess) IsKnown() bool {
}

type AppGetParams struct {
// Zone identifier.
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
}

Expand Down
18 changes: 9 additions & 9 deletions user/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ func TestTokenUpdateWithOptionalParams(t *testing.T) {
"ed17574386854bf78a67040be0a770b0",
user.TokenUpdateParams{
Token: shared.TokenParam{
Name: cloudflare.F("readonly token"),
Condition: cloudflare.F(shared.TokenConditionParam{
RequestIP: cloudflare.F(shared.TokenConditionRequestIPParam{
In: cloudflare.F([]shared.TokenConditionCIDRListParam{"123.123.123.0/24", "2606:4700::/32"}),
NotIn: cloudflare.F([]shared.TokenConditionCIDRListParam{"123.123.123.100/24", "2606:4700:4700::/48"}),
}),
}),
ExpiresOn: cloudflare.F(time.Now()),
Name: cloudflare.F("readonly token"),
NotBefore: cloudflare.F(time.Now()),
Policies: cloudflare.F([]shared.TokenPolicyParam{{
Effect: cloudflare.F(shared.TokenPolicyEffectAllow),
PermissionGroups: cloudflare.F([]shared.TokenPolicyPermissionGroupParam{{
Expand All @@ -107,14 +115,6 @@ func TestTokenUpdateWithOptionalParams(t *testing.T) {
}),
}}),
Status: cloudflare.F(shared.TokenStatusActive),
Condition: cloudflare.F(shared.TokenConditionParam{
RequestIP: cloudflare.F(shared.TokenConditionRequestIPParam{
In: cloudflare.F([]shared.TokenConditionCIDRListParam{"123.123.123.0/24", "2606:4700::/32"}),
NotIn: cloudflare.F([]shared.TokenConditionCIDRListParam{"123.123.123.100/24", "2606:4700:4700::/48"}),
}),
}),
ExpiresOn: cloudflare.F(time.Now()),
NotBefore: cloudflare.F(time.Now()),
},
},
)
Expand Down
Loading

0 comments on commit ce219b7

Please sign in to comment.