Skip to content

Commit 46d310b

Browse files
feat(api): api update
1 parent d5dc757 commit 46d310b

File tree

6 files changed

+56
-26
lines changed

6 files changed

+56
-26
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: 1769
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-965cde604d129fa9ce1aee892f1d851c2c08f687e968d7244c9e7eaac1bebd35.yml
3-
openapi_spec_hash: 58cf3c2b2316b22dcca0b5ec2e66c1fd
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a70ee5e2ed74bb497eaeab36c8bac4e915d0ccceffcac0d49c506286379bb557.yml
3+
openapi_spec_hash: c286686962046e02f46ef991dd5a0e1b
44
config_hash: 6ab6ea94d2c0d06720ca6fb731637307

examples/resources/cloudflare_zero_trust_gateway_settings/resource.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ resource "cloudflare_zero_trust_gateway_settings" "example_zero_trust_gateway_se
1616
}
1717
}
1818
block_page = {
19-
background_color = "background_color"
2019
enabled = true
20+
mode = "customized_block_page"
21+
background_color = "background_color"
2122
footer_text = "--footer--"
2223
header_text = "--header--"
2324
include_context = true
2425
logo_path = "https://logos.com/a.png"
2526
mailto_address = "[email protected]"
2627
mailto_subject = "Blocked User Inquiry"
27-
mode = "customized_block_page"
2828
name = "Cloudflare"
2929
suppress_footer = false
3030
target_uri = "https://example.com"
@@ -52,6 +52,9 @@ resource "cloudflare_zero_trust_gateway_settings" "example_zero_trust_gateway_se
5252
host_selector = {
5353
enabled = false
5454
}
55+
inspection = {
56+
mode = "static"
57+
}
5558
protocol_detection = {
5659
enabled = true
5760
}

internal/services/zero_trust_gateway_settings/data_source_model.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type ZeroTrustGatewaySettingsSettingsDataSourceModel struct {
4343
ExtendedEmailMatching customfield.NestedObject[ZeroTrustGatewaySettingsSettingsExtendedEmailMatchingDataSourceModel] `tfsdk:"extended_email_matching" json:"extended_email_matching,computed"`
4444
Fips customfield.NestedObject[ZeroTrustGatewaySettingsSettingsFipsDataSourceModel] `tfsdk:"fips" json:"fips,computed"`
4545
HostSelector customfield.NestedObject[ZeroTrustGatewaySettingsSettingsHostSelectorDataSourceModel] `tfsdk:"host_selector" json:"host_selector,computed"`
46+
Inspection customfield.NestedObject[ZeroTrustGatewaySettingsSettingsInspectionDataSourceModel] `tfsdk:"inspection" json:"inspection,computed"`
4647
ProtocolDetection customfield.NestedObject[ZeroTrustGatewaySettingsSettingsProtocolDetectionDataSourceModel] `tfsdk:"protocol_detection" json:"protocol_detection,computed"`
4748
Sandbox customfield.NestedObject[ZeroTrustGatewaySettingsSettingsSandboxDataSourceModel] `tfsdk:"sandbox" json:"sandbox,computed"`
4849
TLSDecrypt customfield.NestedObject[ZeroTrustGatewaySettingsSettingsTLSDecryptDataSourceModel] `tfsdk:"tls_decrypt" json:"tls_decrypt,computed"`
@@ -67,15 +68,15 @@ type ZeroTrustGatewaySettingsSettingsAntivirusNotificationSettingsDataSourceMode
6768
}
6869

6970
type ZeroTrustGatewaySettingsSettingsBlockPageDataSourceModel struct {
70-
BackgroundColor types.String `tfsdk:"background_color" json:"background_color,computed"`
7171
Enabled types.Bool `tfsdk:"enabled" json:"enabled,computed"`
72+
Mode types.String `tfsdk:"mode" json:"mode,computed"`
73+
BackgroundColor types.String `tfsdk:"background_color" json:"background_color,computed"`
7274
FooterText types.String `tfsdk:"footer_text" json:"footer_text,computed"`
7375
HeaderText types.String `tfsdk:"header_text" json:"header_text,computed"`
7476
IncludeContext types.Bool `tfsdk:"include_context" json:"include_context,computed"`
7577
LogoPath types.String `tfsdk:"logo_path" json:"logo_path,computed"`
7678
MailtoAddress types.String `tfsdk:"mailto_address" json:"mailto_address,computed"`
7779
MailtoSubject types.String `tfsdk:"mailto_subject" json:"mailto_subject,computed"`
78-
Mode types.String `tfsdk:"mode" json:"mode,computed"`
7980
Name types.String `tfsdk:"name" json:"name,computed"`
8081
ReadOnly types.Bool `tfsdk:"read_only" json:"read_only,computed"`
8182
SourceAccount types.String `tfsdk:"source_account" json:"source_account,computed"`
@@ -117,6 +118,10 @@ type ZeroTrustGatewaySettingsSettingsHostSelectorDataSourceModel struct {
117118
Enabled types.Bool `tfsdk:"enabled" json:"enabled,computed"`
118119
}
119120

121+
type ZeroTrustGatewaySettingsSettingsInspectionDataSourceModel struct {
122+
Mode types.String `tfsdk:"mode" json:"mode,computed"`
123+
}
124+
120125
type ZeroTrustGatewaySettingsSettingsProtocolDetectionDataSourceModel struct {
121126
Enabled types.Bool `tfsdk:"enabled" json:"enabled,computed"`
122127
}

internal/services/zero_trust_gateway_settings/data_source_schema.go

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,21 @@ func DataSourceSchema(ctx context.Context) schema.Schema {
9292
Computed: true,
9393
CustomType: customfield.NewNestedObjectType[ZeroTrustGatewaySettingsSettingsBlockPageDataSourceModel](ctx),
9494
Attributes: map[string]schema.Attribute{
95-
"background_color": schema.StringAttribute{
96-
Description: "If mode is customized_block_page: block page background color in #rrggbb format.",
97-
Computed: true,
98-
},
9995
"enabled": schema.BoolAttribute{
10096
Description: "Enable only cipher suites and TLS versions compliant with FIPS 140-2.",
10197
Computed: true,
10298
},
99+
"mode": schema.StringAttribute{
100+
Description: "Controls whether the user is redirected to a Cloudflare-hosted block page or to a customer-provided URI.\nAvailable values: \"customized_block_page\", \"redirect_uri\".",
101+
Computed: true,
102+
Validators: []validator.String{
103+
stringvalidator.OneOfCaseInsensitive("customized_block_page", "redirect_uri"),
104+
},
105+
},
106+
"background_color": schema.StringAttribute{
107+
Description: "If mode is customized_block_page: block page background color in #rrggbb format.",
108+
Computed: true,
109+
},
103110
"footer_text": schema.StringAttribute{
104111
Description: "If mode is customized_block_page: block page footer text.",
105112
Computed: true,
@@ -124,13 +131,6 @@ func DataSourceSchema(ctx context.Context) schema.Schema {
124131
Description: "If mode is customized_block_page: subject line for emails created from block page.",
125132
Computed: true,
126133
},
127-
"mode": schema.StringAttribute{
128-
Description: "Controls whether the user is redirected to a Cloudflare-hosted block page or to a customer-provided URI.\nAvailable values: \"customized_block_page\", \"redirect_uri\".",
129-
Computed: true,
130-
Validators: []validator.String{
131-
stringvalidator.OneOfCaseInsensitive("customized_block_page", "redirect_uri"),
132-
},
133-
},
134134
"name": schema.StringAttribute{
135135
Description: "If mode is customized_block_page: block page title.",
136136
Computed: true,
@@ -159,8 +159,11 @@ func DataSourceSchema(ctx context.Context) schema.Schema {
159159
CustomType: customfield.NewNestedObjectType[ZeroTrustGatewaySettingsSettingsBodyScanningDataSourceModel](ctx),
160160
Attributes: map[string]schema.Attribute{
161161
"inspection_mode": schema.StringAttribute{
162-
Description: "Set the inspection mode to either `deep` or `shallow`.",
162+
Description: "Set the inspection mode to either `deep` or `shallow`.\nAvailable values: \"deep\", \"shallow\".",
163163
Computed: true,
164+
Validators: []validator.String{
165+
stringvalidator.OneOfCaseInsensitive("deep", "shallow"),
166+
},
164167
},
165168
},
166169
},
@@ -255,6 +258,20 @@ func DataSourceSchema(ctx context.Context) schema.Schema {
255258
},
256259
},
257260
},
261+
"inspection": schema.SingleNestedAttribute{
262+
Description: "Setting to define inspection settings",
263+
Computed: true,
264+
CustomType: customfield.NewNestedObjectType[ZeroTrustGatewaySettingsSettingsInspectionDataSourceModel](ctx),
265+
Attributes: map[string]schema.Attribute{
266+
"mode": schema.StringAttribute{
267+
Description: "Defines the mode of inspection the proxy will use.\n- static: Gateway will use static inspection to inspect HTTP on TCP(80). If TLS decryption is on, Gateway will inspect HTTPS traffic on TCP(443) & UDP(443).\n- dynamic: Gateway will use protocol detection to dynamically inspect HTTP and HTTPS traffic on any port. TLS decryption must be on to inspect HTTPS traffic.\nAvailable values: \"static\", \"dynamic\".",
268+
Computed: true,
269+
Validators: []validator.String{
270+
stringvalidator.OneOfCaseInsensitive("static", "dynamic"),
271+
},
272+
},
273+
},
274+
},
258275
"protocol_detection": schema.SingleNestedAttribute{
259276
Description: "Protocol Detection settings.",
260277
Computed: true,

internal/services/zero_trust_gateway_settings/model.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ type ZeroTrustGatewaySettingsResultEnvelope struct {
1414
}
1515

1616
type ZeroTrustGatewaySettingsModel struct {
17-
ID types.String `tfsdk:"id" json:"-,computed"`
18-
AccountID types.String `tfsdk:"account_id" path:"account_id,required"`
19-
Settings customfield.NestedObject[ZeroTrustGatewaySettingsSettingsModel] `tfsdk:"settings" json:"settings,computed_optional"`
20-
CreatedAt timetypes.RFC3339 `tfsdk:"created_at" json:"created_at,computed" format:"date-time"`
21-
UpdatedAt timetypes.RFC3339 `tfsdk:"updated_at" json:"updated_at,computed" format:"date-time"`
17+
ID types.String `tfsdk:"id" json:"-,computed"`
18+
AccountID types.String `tfsdk:"account_id" path:"account_id,required"`
19+
Settings *ZeroTrustGatewaySettingsSettingsModel `tfsdk:"settings" json:"settings,optional"`
20+
CreatedAt timetypes.RFC3339 `tfsdk:"created_at" json:"created_at,computed" format:"date-time"`
21+
UpdatedAt timetypes.RFC3339 `tfsdk:"updated_at" json:"updated_at,computed" format:"date-time"`
2222
}
2323

2424
func (m ZeroTrustGatewaySettingsModel) MarshalJSON() (data []byte, err error) {
@@ -40,6 +40,7 @@ type ZeroTrustGatewaySettingsSettingsModel struct {
4040
ExtendedEmailMatching customfield.NestedObject[ZeroTrustGatewaySettingsSettingsExtendedEmailMatchingModel] `tfsdk:"extended_email_matching" json:"extended_email_matching,computed_optional"`
4141
Fips *ZeroTrustGatewaySettingsSettingsFipsModel `tfsdk:"fips" json:"fips,optional"`
4242
HostSelector *ZeroTrustGatewaySettingsSettingsHostSelectorModel `tfsdk:"host_selector" json:"host_selector,optional"`
43+
Inspection *ZeroTrustGatewaySettingsSettingsInspectionModel `tfsdk:"inspection" json:"inspection,optional"`
4344
ProtocolDetection *ZeroTrustGatewaySettingsSettingsProtocolDetectionModel `tfsdk:"protocol_detection" json:"protocol_detection,optional"`
4445
Sandbox *ZeroTrustGatewaySettingsSettingsSandboxModel `tfsdk:"sandbox" json:"sandbox,optional"`
4546
TLSDecrypt *ZeroTrustGatewaySettingsSettingsTLSDecryptModel `tfsdk:"tls_decrypt" json:"tls_decrypt,optional"`
@@ -64,15 +65,15 @@ type ZeroTrustGatewaySettingsSettingsAntivirusNotificationSettingsModel struct {
6465
}
6566

6667
type ZeroTrustGatewaySettingsSettingsBlockPageModel struct {
68+
Enabled types.Bool `tfsdk:"enabled" json:"enabled,required"`
69+
Mode types.String `tfsdk:"mode" json:"mode,required"`
6770
BackgroundColor types.String `tfsdk:"background_color" json:"background_color,optional"`
68-
Enabled types.Bool `tfsdk:"enabled" json:"enabled,optional"`
6971
FooterText types.String `tfsdk:"footer_text" json:"footer_text,optional"`
7072
HeaderText types.String `tfsdk:"header_text" json:"header_text,optional"`
7173
IncludeContext types.Bool `tfsdk:"include_context" json:"include_context,optional"`
7274
LogoPath types.String `tfsdk:"logo_path" json:"logo_path,optional"`
7375
MailtoAddress types.String `tfsdk:"mailto_address" json:"mailto_address,optional"`
7476
MailtoSubject types.String `tfsdk:"mailto_subject" json:"mailto_subject,optional"`
75-
Mode types.String `tfsdk:"mode" json:"mode,computed_optional"`
7677
Name types.String `tfsdk:"name" json:"name,optional"`
7778
ReadOnly types.Bool `tfsdk:"read_only" json:"read_only,computed"`
7879
SourceAccount types.String `tfsdk:"source_account" json:"source_account,computed"`
@@ -114,6 +115,10 @@ type ZeroTrustGatewaySettingsSettingsHostSelectorModel struct {
114115
Enabled types.Bool `tfsdk:"enabled" json:"enabled,optional"`
115116
}
116117

118+
type ZeroTrustGatewaySettingsSettingsInspectionModel struct {
119+
Mode types.String `tfsdk:"mode" json:"mode,computed_optional"`
120+
}
121+
117122
type ZeroTrustGatewaySettingsSettingsProtocolDetectionModel struct {
118123
Enabled types.Bool `tfsdk:"enabled" json:"enabled,optional"`
119124
}

internal/services/zero_trust_list/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func ResourceSchema(ctx context.Context) schema.Schema {
5050
Description: "The description of the list.",
5151
Optional: true,
5252
},
53-
"items": schema.ListNestedAttribute{
53+
"items": schema.SetNestedAttribute{
5454
Description: "items to add to the list.",
5555
Optional: true,
5656
NestedObject: schema.NestedAttributeObject{

0 commit comments

Comments
 (0)