Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit ad838ef

Browse files
vvelikodnyVitaly Velikodny
andauthored
add options for rule creation request (#71)
Co-authored-by: Vitaly Velikodny <[email protected]>
1 parent e0b650b commit ad838ef

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

gcore/resource_gcore_cdn_rule.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,44 @@ func resourceCDNRule() *schema.Resource {
9090
},
9191
},
9292
},
93+
"redirect_http_to_https": {
94+
Type: schema.TypeList,
95+
MaxItems: 1,
96+
Optional: true,
97+
Description: "Sets redirect from HTTP protocol to HTTPS for all resource requests.",
98+
Elem: &schema.Resource{
99+
Schema: map[string]*schema.Schema{
100+
"enabled": {
101+
Type: schema.TypeBool,
102+
Optional: true,
103+
Default: true,
104+
},
105+
"value": {
106+
Type: schema.TypeBool,
107+
Required: true,
108+
},
109+
},
110+
},
111+
},
112+
"gzip_on": {
113+
Type: schema.TypeList,
114+
MaxItems: 1,
115+
Optional: true,
116+
Description: "",
117+
Elem: &schema.Resource{
118+
Schema: map[string]*schema.Schema{
119+
"enabled": {
120+
Type: schema.TypeBool,
121+
Optional: true,
122+
Default: true,
123+
},
124+
"value": {
125+
Type: schema.TypeBool,
126+
Required: true,
127+
},
128+
},
129+
},
130+
},
93131
},
94132
},
95133
},
@@ -114,6 +152,8 @@ func resourceCDNRuleCreate(ctx context.Context, d *schema.ResourceData, m interf
114152

115153
resourceID := d.Get("resource_id").(int)
116154

155+
req.Options = listToOptions(d.Get("options").([]interface{}))
156+
117157
result, err := client.Rules().Create(ctx, int64(resourceID), &req)
118158
if err != nil {
119159
return diag.FromErr(err)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.16
55
require (
66
github.com/G-Core/g-dns-sdk-go v0.1.2
77
github.com/G-Core/gcorelabs-storage-sdk-go v0.0.9
8-
github.com/G-Core/gcorelabscdn-go v0.1.4
8+
github.com/G-Core/gcorelabscdn-go v0.1.5
99
github.com/G-Core/gcorelabscloud-go v0.4.42
1010
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
1111
github.com/hashicorp/terraform-exec v0.15.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ github.com/G-Core/gcorelabscdn-go v0.1.3 h1:N49Zu6LQCQ4JccaLdd9ILBXLvWntWMahsr/6
4949
github.com/G-Core/gcorelabscdn-go v0.1.3/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE=
5050
github.com/G-Core/gcorelabscdn-go v0.1.4 h1:Av65dLjuA8I3lhv2GZkrUz2w1fciJZidpDE9O5qr+kw=
5151
github.com/G-Core/gcorelabscdn-go v0.1.4/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE=
52+
github.com/G-Core/gcorelabscdn-go v0.1.5 h1:+OoMq2/KFdy/NH0/u9CQ+E7s6lmo8ycZQH7Abii3Law=
53+
github.com/G-Core/gcorelabscdn-go v0.1.5/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE=
5254
github.com/G-Core/gcorelabscloud-go v0.4.42 h1:LBH4GnH82eQ5L/Lfnzm8KJovbIHPzt2KMitVN1V9kDQ=
5355
github.com/G-Core/gcorelabscloud-go v0.4.42/go.mod h1:Z1MF80mWagEUrxygtYkvW/MJEYNmIUPsIEYBB3cKjOM=
5456
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=

0 commit comments

Comments
 (0)