// Update requests that various attributes of the indicated server be changed. func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult { var result UpdateResult reqBody := opts.ToServerUpdateMap() _, result.Err = client.Put(updateURL(client, id), reqBody, &result.Body, &gophercloud.RequestOpts{ OkCodes: []int{200}, ErrorContext: &ServerError{id: id}, }) return result }
// Update accepts an UpdateOpts struct and updates an existing stack using the values // provided. func Update(c *gophercloud.ServiceClient, stackName, stackID string, opts UpdateOptsBuilder) UpdateResult { var res UpdateResult reqBody, err := opts.ToStackUpdateMap() if err != nil { res.Err = err return res } _, res.Err = c.Put(updateURL(c, stackName, stackID), reqBody, nil, nil) return res }
// ResetMetadata will create multiple new key-value pairs for the given server ID. // Note: Using this operation will erase any already-existing metadata and create // the new metadata provided. To keep any already-existing metadata, use the // UpdateMetadatas or UpdateMetadata function. func ResetMetadata(client *gophercloud.ServiceClient, id string, opts ResetMetadataOptsBuilder) ResetMetadataResult { var res ResetMetadataResult metadata, err := opts.ToMetadataResetMap() if err != nil { res.Err = err return res } _, res.Err = client.Put(metadataURL(client, id), metadata, &res.Body, &gophercloud.RequestOpts{ OkCodes: []int{200}, }) return res }
// CreateMetadatum will create or update the key-value pair with the given key for the given server ID. func CreateMetadatum(client *gophercloud.ServiceClient, id string, opts MetadatumOptsBuilder) CreateMetadatumResult { var res CreateMetadatumResult metadatum, key, err := opts.ToMetadatumCreateMap() if err != nil { res.Err = err return res } _, res.Err = client.Put(metadatumURL(client, id, key), metadatum, &res.Body, &gophercloud.RequestOpts{ OkCodes: []int{200}, }) return res }
// Update will update the Volume with provided information. To extract the updated // Volume from the response, call the Extract method on the UpdateResult. func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult { var res UpdateResult reqBody, err := opts.ToVolumeUpdateMap() if err != nil { res.Err = err return res } _, res.Err = client.Put(updateURL(client, id), reqBody, &res.Body, &gophercloud.RequestOpts{ OkCodes: []int{200}, }) return res }
// Update accepts a UpdateOpts struct and updates an existing network using the // values provided. For more information, see the Create function. func Update(c *gophercloud.ServiceClient, networkID string, opts UpdateOptsBuilder) UpdateResult { var res UpdateResult reqBody, err := opts.ToNetworkUpdateMap() if err != nil { res.Err = err return res } // Send request to API _, res.Err = c.Put(updateURL(c, networkID), reqBody, &res.Body, &gophercloud.RequestOpts{ OkCodes: []int{200, 201}, }) return res }