@@ -22,15 +22,16 @@ func (c CloudStackClient) CreateTemplate(displaytext string, name string, volume
2222}
2323
2424// Returns all available templates
25- func (c CloudStackClient ) ListTemplates (name string ) ([] string , error ) {
25+ func (c CloudStackClient ) ListTemplates (name string , filter string ) (string , error ) {
2626 params := url.Values {}
2727 params .Set ("name" , name )
28+ params .Set ("templatefilter" , filter )
2829 _ , err := NewRequest (c , "listTemplates" , params )
2930 if err != nil {
30- return nil , err
31+ return "" , err
3132 }
3233
33- return nil , err
34+ return "" , err
3435}
3536
3637// Deletes an template by its ID.
@@ -50,3 +51,39 @@ type CreateTemplateResponse struct {
5051 Jobid string `json:"jobid"`
5152 } `json:"createtemplateresponse"`
5253}
54+
55+
56+ type Template struct {
57+ Account string `json:"account"`
58+ Created string `json:"created"`
59+ CrossZones bool `json:"crossZones"`
60+ Displaytext string `json:"displaytext"`
61+ Domain string `json:"domain"`
62+ Domainid string `json:"domainid"`
63+ Format string `json:"format"`
64+ Hypervisor string `json:"hypervisor"`
65+ ID string `json:"id"`
66+ Isextractable bool `json:"isextractable"`
67+ Isfeatured bool `json:"isfeatured"`
68+ Ispublic bool `json:"ispublic"`
69+ Isready bool `json:"isready"`
70+ Name string `json:"name"`
71+ Ostypeid string `json:"ostypeid"`
72+ Ostypename string `json:"ostypename"`
73+ Passwordenabled bool `json:"passwordenabled"`
74+ Size float64 `json:"size"`
75+ Sourcetemplateid string `json:"sourcetemplateid"`
76+ Sshkeyenabled bool `json:"sshkeyenabled"`
77+ Status string `json:"status"`
78+ Tags []interface {} `json:"tags"`
79+ Templatetype string `json:"templatetype"`
80+ Zoneid string `json:"zoneid"`
81+ Zonename string `json:"zonename"`
82+ }
83+
84+ type ListTemplatesResponse struct {
85+ Listtemplatesresponse struct {
86+ Count float64 `json:"count"`
87+ Template []Template `json:"template"`
88+ } `json:"listtemplatesresponse"`
89+ }
0 commit comments