File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -487,6 +487,26 @@ func WithHTTPClient(client *http.Client) ClientOption {
487487 }
488488}
489489
490+ // ListallSetter is an interface that every type that can set listall must implement
491+ type ListallSetter interface {
492+ SetListall (bool )
493+ }
494+
495+ // WithListall takes either a project name or ID and sets the `listall` parameter
496+ func WithListall (listall bool ) OptionFunc {
497+ return func (cs * CloudStackClient , p interface {}) error {
498+ ps , ok := p .(ListallSetter )
499+
500+ if ! ok {
501+ return nil
502+ }
503+
504+ ps .SetListall (listall )
505+
506+ return nil
507+ }
508+ }
509+
490510// ProjectIDSetter is an interface that every type that can set a project ID must implement
491511type ProjectIDSetter interface {
492512 SetProjectid (string )
Original file line number Diff line number Diff line change @@ -585,6 +585,25 @@ func (as *allServices) GeneralCode() ([]byte, error) {
585585 pn (" }" )
586586 pn ("}" )
587587 pn ("" )
588+ pn ("// ListallSetter is an interface that every type that can set listall must implement" )
589+ pn ("type ListallSetter interface {" )
590+ pn (" SetListall(bool)" )
591+ pn ("}" )
592+ pn ("" )
593+ pn ("// WithListall takes either a project name or ID and sets the `listall` parameter" )
594+ pn ("func WithListall(listall bool) OptionFunc {" )
595+ pn (" return func(cs *CloudStackClient, p interface{}) error {" )
596+ pn (" ps, ok := p.(ListallSetter)" )
597+ pn ("" )
598+ pn (" if !ok {" )
599+ pn (" return nil" )
600+ pn (" }" )
601+ pn ("" )
602+ pn (" ps.SetListall(listall)" )
603+ pn ("" )
604+ pn (" return nil" )
605+ pn (" }" )
606+ pn ("}" )
588607 pn ("// ProjectIDSetter is an interface that every type that can set a project ID must implement" )
589608 pn ("type ProjectIDSetter interface {" )
590609 pn (" SetProjectid(string)" )
You can’t perform that action at this time.
0 commit comments