Adding WithListall option
diff --git a/cloudstack/cloudstack.go b/cloudstack/cloudstack.go
index 5b6b0ed..83f8726 100644
--- a/cloudstack/cloudstack.go
+++ b/cloudstack/cloudstack.go
@@ -487,6 +487,26 @@
}
}
+// ListallSetter is an interface that every type that can set listall must implement
+type ListallSetter interface {
+ SetListall(bool)
+}
+
+// WithListall takes either a project name or ID and sets the `listall` parameter
+func WithListall(listall bool) OptionFunc {
+ return func(cs *CloudStackClient, p interface{}) error {
+ ps, ok := p.(ListallSetter)
+
+ if !ok {
+ return nil
+ }
+
+ ps.SetListall(listall)
+
+ return nil
+ }
+}
+
// ProjectIDSetter is an interface that every type that can set a project ID must implement
type ProjectIDSetter interface {
SetProjectid(string)
diff --git a/generate/generate.go b/generate/generate.go
index 495baf4..d81235a 100644
--- a/generate/generate.go
+++ b/generate/generate.go
@@ -585,6 +585,25 @@
pn(" }")
pn("}")
pn("")
+ pn("// ListallSetter is an interface that every type that can set listall must implement")
+ pn("type ListallSetter interface {")
+ pn(" SetListall(bool)")
+ pn("}")
+ pn("")
+ pn("// WithListall takes either a project name or ID and sets the `listall` parameter")
+ pn("func WithListall(listall bool) OptionFunc {")
+ pn(" return func(cs *CloudStackClient, p interface{}) error {")
+ pn(" ps, ok := p.(ListallSetter)")
+ pn("")
+ pn(" if !ok {")
+ pn(" return nil")
+ pn(" }")
+ pn("")
+ pn(" ps.SetListall(listall)")
+ pn("")
+ pn(" return nil")
+ pn(" }")
+ pn("}")
pn("// ProjectIDSetter is an interface that every type that can set a project ID must implement")
pn("type ProjectIDSetter interface {")
pn(" SetProjectid(string)")