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

Commit 189c4bc

Browse files
vvelikodnyVitaly Velikodny
andauthored
add websockets option (#88)
Co-authored-by: Vitaly Velikodny <[email protected]>
1 parent f2fba93 commit 189c4bc

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

gcore/resource_gcore_cdn_resource.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,25 @@ var (
333333
},
334334
},
335335
},
336+
"websockets": {
337+
Type: schema.TypeList,
338+
MaxItems: 1,
339+
Optional: true,
340+
Description: "",
341+
Elem: &schema.Resource{
342+
Schema: map[string]*schema.Schema{
343+
"enabled": {
344+
Type: schema.TypeBool,
345+
Optional: true,
346+
Default: true,
347+
},
348+
"value": {
349+
Type: schema.TypeBool,
350+
Required: true,
351+
},
352+
},
353+
},
354+
},
336355
},
337356
},
338357
}
@@ -704,6 +723,16 @@ func listToOptions(l []interface{}) *gcdn.Options {
704723
opts.StaticHeaders.Value[k] = v.(string)
705724
}
706725
}
726+
if opt, ok := getOptByName(fields, "websockets"); ok {
727+
enabled := true
728+
if _, ok := opt["enabled"]; ok {
729+
enabled = opt["enabled"].(bool)
730+
}
731+
opts.WebSockets = &gcdn.WebSockets{
732+
Enabled: enabled,
733+
Value: opt["value"].(bool),
734+
}
735+
}
707736
return &opts
708737
}
709738

@@ -787,6 +816,10 @@ func optionsToList(options *gcdn.Options) []interface{} {
787816
m := structToMap(options.StaticHeaders)
788817
result["static_headers"] = []interface{}{m}
789818
}
819+
if options.WebSockets != nil {
820+
m := structToMap(options.WebSockets)
821+
result["websockets"] = []interface{}{m}
822+
}
790823
return []interface{}{result}
791824
}
792825

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/AlekSi/pointer v1.2.0
77
github.com/G-Core/g-dns-sdk-go v0.1.2
88
github.com/G-Core/gcore-storage-sdk-go v0.1.2
9-
github.com/G-Core/gcorelabscdn-go v0.1.18
9+
github.com/G-Core/gcorelabscdn-go v0.1.19
1010
github.com/G-Core/gcorelabscloud-go v0.4.43
1111
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
1212
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ github.com/G-Core/gcore-storage-sdk-go v0.1.2 h1:bCKATw47kwYZLXDCgiQ4IS5ecwSv9HQ
4949
github.com/G-Core/gcore-storage-sdk-go v0.1.2/go.mod h1:e/5w5R2Uh6T7g6oAc5SpTKZJInFG6FyYYvGpUgRwCQ4=
5050
github.com/G-Core/gcorelabscdn-go v0.1.18 h1:ISDvMA0EFw6PJnQKTnJ5lAJ5mm1MVRbjMZoZkClA42I=
5151
github.com/G-Core/gcorelabscdn-go v0.1.18/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE=
52+
github.com/G-Core/gcorelabscdn-go v0.1.19 h1:Vu7BRcRmSALqSpvwxZvwQnRpQ3B/cK94dNLppYMgq80=
53+
github.com/G-Core/gcorelabscdn-go v0.1.19/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE=
5254
github.com/G-Core/gcorelabscloud-go v0.4.43 h1:e4D1iJSoPKye3YyOXS7vER2ZYitu51cpAK68n1c3sGM=
5355
github.com/G-Core/gcorelabscloud-go v0.4.43/go.mod h1:Z1MF80mWagEUrxygtYkvW/MJEYNmIUPsIEYBB3cKjOM=
5456
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=

0 commit comments

Comments
 (0)