@@ -101,3 +101,38 @@ func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pa
101101 return VolumeTypePage {pagination.LinkedPageBase {PageResult : r }}
102102 })
103103}
104+
105+ // UpdateOptsBuilder allows extensions to add additional parameters to the
106+ // Update request.
107+ type UpdateOptsBuilder interface {
108+ ToVolumeTypeUpdateMap () (map [string ]interface {}, error )
109+ }
110+
111+ // UpdateOpts contain options for updating an existing Volume Type. This object is passed
112+ // to the volumetypes.Update function. For more information about the parameters, see
113+ // the Volume Type object.
114+ type UpdateOpts struct {
115+ Name string `json:"name,omitempty"`
116+ Description string `json:"description,omitempty"`
117+ IsPublic * bool `json:"is_public,omitempty"`
118+ }
119+
120+ // ToVolumeUpdateMap assembles a request body based on the contents of an
121+ // UpdateOpts.
122+ func (opts UpdateOpts ) ToVolumeTypeUpdateMap () (map [string ]interface {}, error ) {
123+ return gophercloud .BuildRequestBody (opts , "volume_type" )
124+ }
125+
126+ // Update will update the Volume Type with provided information. To extract the updated
127+ // Volume Type from the response, call the Extract method on the UpdateResult.
128+ func Update (client * gophercloud.ServiceClient , id string , opts UpdateOptsBuilder ) (r UpdateResult ) {
129+ b , err := opts .ToVolumeTypeUpdateMap ()
130+ if err != nil {
131+ r .Err = err
132+ return
133+ }
134+ _ , r .Err = client .Put (updateURL (client , id ), b , & r .Body , & gophercloud.RequestOpts {
135+ OkCodes : []int {200 },
136+ })
137+ return
138+ }
0 commit comments