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

Commit 57b4a8d

Browse files
vvelikodnyVitaly Velikodny
andauthored
add 'gzip_on' resource option (#69)
Co-authored-by: Vitaly Velikodny <[email protected]>
1 parent 0fc1e4c commit 57b4a8d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

gcore/resource_gcore_cdn_resource.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,24 @@ func resourceCDNResource() *schema.Resource {
144144
},
145145
},
146146
},
147+
"gzip_on": {
148+
Type: schema.TypeList,
149+
MaxItems: 1,
150+
Optional: true,
151+
Description: "",
152+
Elem: &schema.Resource{
153+
Schema: map[string]*schema.Schema{
154+
"enabled": {
155+
Type: schema.TypeBool,
156+
Required: true,
157+
},
158+
"value": {
159+
Type: schema.TypeBool,
160+
Required: true,
161+
},
162+
},
163+
},
164+
},
147165
},
148166
},
149167
},
@@ -315,6 +333,12 @@ func listToOptions(l []interface{}) *gcdn.Options {
315333
Value: opt["value"].(bool),
316334
}
317335
}
336+
if opt, ok := getOptByName(fields, "gzip_on"); ok {
337+
opts.GzipOn = &gcdn.GzipOn{
338+
Enabled: opt["enabled"].(bool),
339+
Value: opt["value"].(bool),
340+
}
341+
}
318342
return &opts
319343
}
320344

@@ -354,6 +378,10 @@ func optionsToList(options *gcdn.Options) []interface{} {
354378
m := structToMap(options.RedirectHttpToHttps)
355379
result["redirect_http_to_https"] = []interface{}{m}
356380
}
381+
if options.GzipOn != nil {
382+
m := structToMap(options.GzipOn)
383+
result["gzip_on"] = []interface{}{m}
384+
}
357385
return []interface{}{result}
358386
}
359387

0 commit comments

Comments
 (0)