func (command *commandGet) Execute(resource *handler.Resource) { containerName := resource.Params.(*paramsGet).container objectName := resource.Params.(*paramsGet).object objectRaw := objects.Get(command.Ctx.ServiceClient, containerName, objectName, nil) objectInfo, err := objectRaw.Extract() if err != nil { resource.Err = err return } objectMetadata, err := objectRaw.ExtractMetadata() if err != nil { resource.Err = err return } resource.Result = structs.Map(objectInfo) resource.Result.(map[string]interface{})["Name"] = objectName resource.Result.(map[string]interface{})["Metadata"] = objectMetadata }
// Get is a function that retrieves the metadata of an object. To extract just the custom // metadata, pass the GetResult response to the ExtractMetadata function. func Get(c *gophercloud.ServiceClient, containerName, objectName string, opts os.GetOptsBuilder) os.GetResult { return os.Get(c, containerName, objectName, opts) }