From c1f117035711ee9d2dc2346ddbecbe44009c0785 Mon Sep 17 00:00:00 2001 From: Aleksei Iakovlev Date: Mon, 24 Feb 2025 16:08:43 +0800 Subject: [PATCH] CDP-1428 extend fastedge option --- docs/resources/cdn_resource.md | 2 ++ docs/resources/cdn_rule.md | 2 ++ docs/resources/cdn_rule_template.md | 2 ++ gcore/resource_gcore_cdn_options.go | 12 ++++++++++++ gcore/resource_gcore_cdn_resource.go | 2 ++ go.mod | 2 +- go.sum | 2 ++ 7 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/resources/cdn_resource.md b/docs/resources/cdn_resource.md index b613473..95283bf 100644 --- a/docs/resources/cdn_resource.md +++ b/docs/resources/cdn_resource.md @@ -264,6 +264,8 @@ Required: Optional: - `enabled` (Boolean) Determines if the FastEdge application should be called whenever HTTP request headers are received. +- `execute_on_edge` (Boolean) Determines if the request should be executed at the edge nodes. +- `execute_on_shield` (Boolean) Determines if the request should be executed at the shield nodes. - `interrupt_on_error` (Boolean) Determines if the request execution should be interrupted when an error occurs. diff --git a/docs/resources/cdn_rule.md b/docs/resources/cdn_rule.md index 3382d28..b9f5eb4 100644 --- a/docs/resources/cdn_rule.md +++ b/docs/resources/cdn_rule.md @@ -294,6 +294,8 @@ Required: Optional: - `enabled` (Boolean) Determines if the FastEdge application should be called whenever HTTP request headers are received. +- `execute_on_edge` (Boolean) Determines if the request should be executed at the edge nodes. +- `execute_on_shield` (Boolean) Determines if the request should be executed at the shield nodes. - `interrupt_on_error` (Boolean) Determines if the request execution should be interrupted when an error occurs. diff --git a/docs/resources/cdn_rule_template.md b/docs/resources/cdn_rule_template.md index 0ce937e..c466b93 100644 --- a/docs/resources/cdn_rule_template.md +++ b/docs/resources/cdn_rule_template.md @@ -208,6 +208,8 @@ Required: Optional: - `enabled` (Boolean) Determines if the FastEdge application should be called whenever HTTP request headers are received. +- `execute_on_edge` (Boolean) Determines if the request should be executed at the edge nodes. +- `execute_on_shield` (Boolean) Determines if the request should be executed at the shield nodes. - `interrupt_on_error` (Boolean) Determines if the request execution should be interrupted when an error occurs. diff --git a/gcore/resource_gcore_cdn_options.go b/gcore/resource_gcore_cdn_options.go index 652d3fc..c4c7770 100644 --- a/gcore/resource_gcore_cdn_options.go +++ b/gcore/resource_gcore_cdn_options.go @@ -216,6 +216,18 @@ var ( Default: true, Description: "Determines if the request execution should be interrupted when an error occurs.", }, + "execute_on_edge": { + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Determines if the request should be executed at the edge nodes.", + }, + "execute_on_shield": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Determines if the request should be executed at the shield nodes.", + }, }, }, }, diff --git a/gcore/resource_gcore_cdn_resource.go b/gcore/resource_gcore_cdn_resource.go index a79aca8..11a8dea 100644 --- a/gcore/resource_gcore_cdn_resource.go +++ b/gcore/resource_gcore_cdn_resource.go @@ -340,6 +340,8 @@ func listToOptions(l []interface{}) *gcdn.Options { Enabled: onRequestHeaders["enabled"].(bool), AppID: onRequestHeaders["app_id"].(string), InterruptOnError: onRequestHeaders["interrupt_on_error"].(bool), + ExecuteOnEdge: onRequestHeaders["execute_on_edge"].(bool), + ExecuteOnShield: onRequestHeaders["execute_on_shield"].(bool), } } } diff --git a/go.mod b/go.mod index e3ca7ee..ee90c6e 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/AlekSi/pointer v1.2.0 github.com/G-Core/gcore-dns-sdk-go v0.2.9 github.com/G-Core/gcore-storage-sdk-go v0.1.34 - github.com/G-Core/gcorelabscdn-go v1.0.27 + github.com/G-Core/gcorelabscdn-go v1.0.28 github.com/G-Core/gcorelabscloud-go v0.11.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/terraform-plugin-sdk/v2 v2.27.0 diff --git a/go.sum b/go.sum index ccba9e5..9d4f1e3 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,8 @@ github.com/G-Core/gcore-storage-sdk-go v0.1.34 h1:0GPQfz1kA6mQi6fiisGsh0Um4H9PZe github.com/G-Core/gcore-storage-sdk-go v0.1.34/go.mod h1:BUAEZZZJJt/+luRFunqziv3+JnbVMLbQXDWz9kV8Te8= github.com/G-Core/gcorelabscdn-go v1.0.27 h1:XglfvHLYmb1NJxATig6bdPyN9DKdGt5vUlIc+kbpu6s= github.com/G-Core/gcorelabscdn-go v1.0.27/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE= +github.com/G-Core/gcorelabscdn-go v1.0.28 h1:6ymVMV3HPTICO5BWJCEcZZzgY+Pc/+/TQMzeXMN77GQ= +github.com/G-Core/gcorelabscdn-go v1.0.28/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE= github.com/G-Core/gcorelabscloud-go v0.11.0 h1:JzlEp0Cgm3i4lQFJKhscDK76uWYH2pQNzZOwKtvrMUQ= github.com/G-Core/gcorelabscloud-go v0.11.0/go.mod h1:13Z1USxlxPbDFuYQyWqfNexlk4kUvOYTXbnvV/Z1lZo= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=