Skip to content

Support storage policy on container create #2074

@iokiwi

Description

@iokiwi

Add support for the X-Storage-Policy header in containers.CreateOpts. https://docs.openstack.org/api-ref/object-store/?expanded=create-container-detail#create-container

Example usage.

createOpts := containers.CreateOpts{
	ContentType:   "application/json",
	StoragePolicy: "nz-hlz-1--o1--sr-r3",
}

result := containers.Create(swiftClient, "go-test-2", createOpts)

Inspection of the StoragePolicy attribute of a container is already supported without modification via the containers.Get method

containerDetails := containers.Get(swiftClient, container.Name, nil)
fmt.Printf("%v+\n\n", containerDetails)

// {{{<nil> map[Accept-Ranges:[bytes] Content-Length:[0] Content-Type:[application/json; charset=utf-8] Date:[Thu, 17 Dec 2020 12:43:59 GMT] Server:[nginx/1.16.0] X-Container-Bytes-Used:[0] X-Container-Object-Count:[0] X-Storage-Policy:[nz-hlz-1--o1--sr-r3] X-Timestamp:[1608206959.71870] X-Trans-Id:[txcc5852ecf7134117bfdc4-005fdb528f]] <nil>}}}+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions