Create [a-z]+List types that are also Values.
diff --git a/openstack/cdn/v1/services/requests.go b/openstack/cdn/v1/services/requests.go
index 96922e5..62925c3 100644
--- a/openstack/cdn/v1/services/requests.go
+++ b/openstack/cdn/v1/services/requests.go
@@ -235,7 +235,7 @@
)
type value interface {
- toPatchValue() map[string]interface{}
+ toPatchValue() interface{}
appropriatePath() Path
}
diff --git a/openstack/cdn/v1/services/results.go b/openstack/cdn/v1/services/results.go
index 7d6878c..3e806be 100644
--- a/openstack/cdn/v1/services/results.go
+++ b/openstack/cdn/v1/services/results.go
@@ -17,7 +17,7 @@
Protocol string `mapstructure:"protocol" json:"protocol,omitempty"`
}
-func (d Domain) toPatchValue() map[string]interface{} {
+func (d Domain) toPatchValue() interface{} {
r := make(map[string]interface{})
r["domain"] = d.Domain
if d.Protocol != "" {
@@ -30,6 +30,21 @@
return PathDomains
}
+// DomainList provides a useful way to perform bulk operations in a single Patch.
+type DomainList []Domain
+
+func (list DomainList) toPatchValue() interface{} {
+ r := make([]interface{}, len(list))
+ for i, domain := range list {
+ r[i] = domain.toPatchValue()
+ }
+ return r
+}
+
+func (list DomainList) appropriatePath() Path {
+ return PathDomains
+}
+
// OriginRule represents a rule that defines when an origin should be accessed.
type OriginRule struct {
// Specifies the name of this rule.
@@ -52,7 +67,7 @@
Rules []OriginRule `mapstructure:"rules" json:"rules,omitempty"`
}
-func (o Origin) toPatchValue() map[string]interface{} {
+func (o Origin) toPatchValue() interface{} {
r := make(map[string]interface{})
r["origin"] = o.Origin
r["port"] = o.Port
@@ -72,6 +87,21 @@
return PathOrigins
}
+// OriginList provides a useful way to perform bulk operations in a single Patch.
+type OriginList []Domain
+
+func (list OriginList) toPatchValue() interface{} {
+ r := make([]interface{}, len(list))
+ for i, origin := range list {
+ r[i] = origin.toPatchValue()
+ }
+ return r
+}
+
+func (list OriginList) appropriatePath() Path {
+ return PathOrigins
+}
+
// TTLRule specifies a rule that determines if a TTL should be applied to an asset.
type TTLRule struct {
// Specifies the name of this rule.
@@ -90,7 +120,7 @@
Rules []TTLRule `mapstructure:"rules" json:"rules,omitempty"`
}
-func (c CacheRule) toPatchValue() map[string]interface{} {
+func (c CacheRule) toPatchValue() interface{} {
r := make(map[string]interface{})
r["name"] = c.Name
r["ttl"] = c.TTL
@@ -107,6 +137,21 @@
return PathCaching
}
+// CacheRuleList provides a useful way to perform bulk operations in a single Patch.
+type CacheRuleList []Domain
+
+func (list CacheRuleList) toPatchValue() interface{} {
+ r := make([]interface{}, len(list))
+ for i, rule := range list {
+ r[i] = rule.toPatchValue()
+ }
+ return r
+}
+
+func (list CacheRuleList) appropriatePath() Path {
+ return PathCaching
+}
+
// RestrictionRule specifies a rule that determines if this restriction should be applied to an asset.
type RestrictionRule struct {
// Specifies the name of this rule.