Skip to content

Commit 13ed254

Browse files
chore(api): update composite API spec
1 parent 440f903 commit 13ed254

File tree

4 files changed

+108
-30
lines changed

4 files changed

+108
-30
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 2026
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-5807819d215d59200ffb9f5f7a040de93818fd7450f3a0e39ae7f7a92289bef0.yml
3-
openapi_spec_hash: 7f66c4c6998df3f3413c58189e894df4
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d5d4d4462803aafff1863a0e621429533bc3a27662fb7261d32d9b79f9ee98fd.yml
3+
openapi_spec_hash: 202d4dd1e9e4e72678ec6290f111b5ee
44
config_hash: 7a08b6d7e050d324501d76c833118c84

hostnames/settingtls.go

Lines changed: 105 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/cloudflare/cloudflare-go/v6/internal/requestconfig"
1717
"github.com/cloudflare/cloudflare-go/v6/option"
1818
"github.com/cloudflare/cloudflare-go/v6/packages/pagination"
19-
"github.com/cloudflare/cloudflare-go/v6/shared"
2019
"github.com/tidwall/gjson"
2120
)
2221

@@ -117,7 +116,15 @@ type Setting struct {
117116
Status string `json:"status"`
118117
// This is the time the tls setting was updated.
119118
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
120-
// The tls setting value.
119+
// The TLS setting value. The type depends on the `setting_id` used in the request
120+
// path:
121+
//
122+
// - `ciphers`: an array of allowed cipher suite strings in BoringSSL format (e.g.,
123+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
124+
// - `min_tls_version`: a string indicating the minimum TLS version — one of
125+
// `"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"` (e.g., `"1.2"`)
126+
// - `http2`: a string indicating whether HTTP/2 is enabled — `"on"` or `"off"`
127+
// (e.g., `"on"`)
121128
Value SettingValueUnion `json:"value"`
122129
JSON settingJSON `json:"-"`
123130
}
@@ -141,25 +148,28 @@ func (r settingJSON) RawJSON() string {
141148
return r.raw
142149
}
143150

144-
// The tls setting value.
151+
// The TLS setting value. The type depends on the `setting_id` used in the request
152+
// path:
145153
//
146-
// Union satisfied by [shared.UnionFloat], [shared.UnionString] or
147-
// [SettingValueArray].
154+
// - `ciphers`: an array of allowed cipher suite strings in BoringSSL format (e.g.,
155+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
156+
// - `min_tls_version`: a string indicating the minimum TLS version — one of
157+
// `"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"` (e.g., `"1.2"`)
158+
// - `http2`: a string indicating whether HTTP/2 is enabled — `"on"` or `"off"`
159+
// (e.g., `"on"`)
160+
//
161+
// Union satisfied by [SettingValueString] or [SettingValueArray].
148162
type SettingValueUnion interface {
149-
ImplementsSettingValueUnion()
163+
implementsSettingValueUnion()
150164
}
151165

152166
func init() {
153167
apijson.RegisterUnion(
154168
reflect.TypeOf((*SettingValueUnion)(nil)).Elem(),
155169
"",
156-
apijson.UnionVariant{
157-
TypeFilter: gjson.Number,
158-
Type: reflect.TypeOf(shared.UnionFloat(0)),
159-
},
160170
apijson.UnionVariant{
161171
TypeFilter: gjson.String,
162-
Type: reflect.TypeOf(shared.UnionString("")),
172+
Type: reflect.TypeOf(SettingValueString("")),
163173
},
164174
apijson.UnionVariant{
165175
TypeFilter: gjson.JSON,
@@ -168,21 +178,51 @@ func init() {
168178
)
169179
}
170180

181+
type SettingValueString string
182+
183+
const (
184+
SettingValueString1_0 SettingValueString = "1.0"
185+
SettingValueString1_1 SettingValueString = "1.1"
186+
SettingValueString1_2 SettingValueString = "1.2"
187+
SettingValueString1_3 SettingValueString = "1.3"
188+
SettingValueStringOn SettingValueString = "on"
189+
SettingValueStringOff SettingValueString = "off"
190+
)
191+
192+
func (r SettingValueString) IsKnown() bool {
193+
switch r {
194+
case SettingValueString1_0, SettingValueString1_1, SettingValueString1_2, SettingValueString1_3, SettingValueStringOn, SettingValueStringOff:
195+
return true
196+
}
197+
return false
198+
}
199+
200+
func (r SettingValueString) implementsSettingValueUnion() {}
201+
202+
func (r SettingValueString) implementsSettingValueUnionParam() {}
203+
171204
type SettingValueArray []string
172205

173-
func (r SettingValueArray) ImplementsSettingValueUnion() {}
206+
func (r SettingValueArray) implementsSettingValueUnion() {}
174207

175-
// The tls setting value.
208+
// The TLS setting value. The type depends on the `setting_id` used in the request
209+
// path:
176210
//
177-
// Satisfied by [shared.UnionFloat], [shared.UnionString],
178-
// [hostnames.SettingValueArrayParam].
211+
// - `ciphers`: an array of allowed cipher suite strings in BoringSSL format (e.g.,
212+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
213+
// - `min_tls_version`: a string indicating the minimum TLS version — one of
214+
// `"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"` (e.g., `"1.2"`)
215+
// - `http2`: a string indicating whether HTTP/2 is enabled — `"on"` or `"off"`
216+
// (e.g., `"on"`)
217+
//
218+
// Satisfied by [hostnames.SettingValueString], [hostnames.SettingValueArrayParam].
179219
type SettingValueUnionParam interface {
180-
ImplementsSettingValueUnionParam()
220+
implementsSettingValueUnionParam()
181221
}
182222

183223
type SettingValueArrayParam []string
184224

185-
func (r SettingValueArrayParam) ImplementsSettingValueUnionParam() {}
225+
func (r SettingValueArrayParam) implementsSettingValueUnionParam() {}
186226

187227
type SettingTLSDeleteResponse struct {
188228
// This is the time the tls setting was originally created for this hostname.
@@ -193,7 +233,15 @@ type SettingTLSDeleteResponse struct {
193233
Status string `json:"status"`
194234
// This is the time the tls setting was updated.
195235
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
196-
// The tls setting value.
236+
// The TLS setting value. The type depends on the `setting_id` used in the request
237+
// path:
238+
//
239+
// - `ciphers`: an array of allowed cipher suite strings in BoringSSL format (e.g.,
240+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
241+
// - `min_tls_version`: a string indicating the minimum TLS version — one of
242+
// `"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"` (e.g., `"1.2"`)
243+
// - `http2`: a string indicating whether HTTP/2 is enabled — `"on"` or `"off"`
244+
// (e.g., `"on"`)
197245
Value SettingValueUnion `json:"value"`
198246
JSON settingTLSDeleteResponseJSON `json:"-"`
199247
}
@@ -227,7 +275,15 @@ type SettingTLSGetResponse struct {
227275
Status string `json:"status"`
228276
// This is the time the tls setting was updated.
229277
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
230-
// The tls setting value.
278+
// The TLS setting value. The type depends on the `setting_id` used in the request
279+
// path:
280+
//
281+
// - `ciphers`: an array of allowed cipher suite strings in BoringSSL format (e.g.,
282+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
283+
// - `min_tls_version`: a string indicating the minimum TLS version — one of
284+
// `"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"` (e.g., `"1.2"`)
285+
// - `http2`: a string indicating whether HTTP/2 is enabled — `"on"` or `"off"`
286+
// (e.g., `"on"`)
231287
Value SettingValueUnion `json:"value"`
232288
JSON settingTLSGetResponseJSON `json:"-"`
233289
}
@@ -255,15 +311,29 @@ func (r settingTLSGetResponseJSON) RawJSON() string {
255311
type SettingTLSUpdateParams struct {
256312
// Identifier.
257313
ZoneID param.Field[string] `path:"zone_id,required"`
258-
// The tls setting value.
314+
// The TLS setting value. The type depends on the `setting_id` used in the request
315+
// path:
316+
//
317+
// - `ciphers`: an array of allowed cipher suite strings in BoringSSL format (e.g.,
318+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
319+
// - `min_tls_version`: a string indicating the minimum TLS version — one of
320+
// `"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"` (e.g., `"1.2"`)
321+
// - `http2`: a string indicating whether HTTP/2 is enabled — `"on"` or `"off"`
322+
// (e.g., `"on"`)
259323
Value param.Field[SettingValueUnionParam] `json:"value,required"`
260324
}
261325

262326
func (r SettingTLSUpdateParams) MarshalJSON() (data []byte, err error) {
263327
return apijson.MarshalRoot(r)
264328
}
265329

266-
// The TLS Setting name.
330+
// The TLS Setting name. The value type depends on the setting:
331+
//
332+
// - `ciphers`: value is an array of cipher suite strings (e.g.,
333+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
334+
// - `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`,
335+
// or `"1.3"`)
336+
// - `http2`: value is `"on"` or `"off"`
267337
type SettingTLSUpdateParamsSettingID string
268338

269339
const (
@@ -424,7 +494,13 @@ type SettingTLSDeleteParams struct {
424494
ZoneID param.Field[string] `path:"zone_id,required"`
425495
}
426496

427-
// The TLS Setting name.
497+
// The TLS Setting name. The value type depends on the setting:
498+
//
499+
// - `ciphers`: value is an array of cipher suite strings (e.g.,
500+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
501+
// - `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`,
502+
// or `"1.3"`)
503+
// - `http2`: value is `"on"` or `"off"`
428504
type SettingTLSDeleteParamsSettingID string
429505

430506
const (
@@ -585,7 +661,13 @@ type SettingTLSGetParams struct {
585661
ZoneID param.Field[string] `path:"zone_id,required"`
586662
}
587663

588-
// The TLS Setting name.
664+
// The TLS Setting name. The value type depends on the setting:
665+
//
666+
// - `ciphers`: value is an array of cipher suite strings (e.g.,
667+
// `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`)
668+
// - `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`,
669+
// or `"1.3"`)
670+
// - `http2`: value is `"on"` or `"off"`
589671
type SettingTLSGetParamsSettingID string
590672

591673
const (

hostnames/settingtls_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestSettingTLSUpdate(t *testing.T) {
3333
"app.example.com",
3434
hostnames.SettingTLSUpdateParams{
3535
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
36-
Value: cloudflare.F[hostnames.SettingValueUnionParam](hostnames.SettingValueArrayParam([]string{"ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"})),
36+
Value: cloudflare.F[hostnames.SettingValueUnionParam](hostnames.SettingValueString(hostnames.SettingValueString1_0)),
3737
},
3838
)
3939
if err != nil {

shared/union.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ func (UnionString) ImplementsConfigUpdateParamsToolsZarazManagedComponentDefault
123123
func (UnionString) ImplementsConfigUpdateParamsToolsZarazManagedComponentSettingsUnion() {}
124124
func (UnionString) ImplementsConfigUpdateParamsToolsWorkerDefaultFieldsUnion() {}
125125
func (UnionString) ImplementsConfigUpdateParamsToolsWorkerSettingsUnion() {}
126-
func (UnionString) ImplementsSettingValueUnionParam() {}
127-
func (UnionString) ImplementsSettingValueUnion() {}
128126
func (UnionString) ImplementsPresetNewResponseDataPermissionsPluginsConfigUnion() {}
129127
func (UnionString) ImplementsPresetUpdateResponseDataPermissionsPluginsConfigUnion() {}
130128
func (UnionString) ImplementsPresetDeleteResponseDataPermissionsPluginsConfigUnion() {}
@@ -291,8 +289,6 @@ func (UnionFloat) ImplementsAccessAIControlMcpPortalReadResponseServersUpdatedPr
291289
func (UnionFloat) ImplementsAccessAIControlMcpPortalReadResponseServersUpdatedToolsUnion() {}
292290
func (UnionFloat) ImplementsRankingTimeseriesGroupsResponseSerie0Union() {}
293291
func (UnionFloat) ImplementsRankingInternetServiceTimeseriesGroupsResponseSerie0Union() {}
294-
func (UnionFloat) ImplementsSettingValueUnionParam() {}
295-
func (UnionFloat) ImplementsSettingValueUnion() {}
296292
func (UnionFloat) ImplementsThreatEventListParamsSearchValueUnion() {}
297293
func (UnionFloat) ImplementsThreatEventListParamsSearchValueArrayItemUnion() {}
298294
func (UnionFloat) ImplementsLogListParamsFiltersValueUnion() {}

0 commit comments

Comments
 (0)