Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i make my container public? and also How can i set custom header while creating container? #309

Open
amarvora opened this issue Jul 1, 2020 · 1 comment

Comments

@amarvora
Copy link

amarvora commented Jul 1, 2020

Hello

I have 2 questions which I didn't found any where. I hope here I can get some help.

Q1) I want to restrict some region replicas so for that swift service have an option to set 'X-Storage-Policy' in header. Below is the curl command for doing that. (Reference: ) I didn't found such option in objectStoreV1() service.

curl -v -X PUT -H 'X-Auth-Token: '
-H 'X-Storage-Policy: gold' http://127.0.0.1:8080/v1/AUTH_test/myCont0

Q2) I would like to create public container (by default its generating private container) for that I have append metadata 'X-Container-Read' => '.r:"', 'X-Container-Write' => '.r:"'after creating container which is not working. Below is my class function

public function create_container($name) {
        $o_container = self::$service->createContainer(array('name' => $name));
        $o_container->resetMetadata(array('X-Storage-Policy' => 'global-repl-onl','X-Container-Read' => '.r:*"', 'X-Container-Write' => '.r:*"' ));

        if(is_object($o_container)) {
            if($o_container->name == $name)
                return true;
            else
                return false;
        } else
            return false;
    }

Can you help me with above 2 my question. It will be great help

Thank you

@jonathan-ruiz
Copy link

jonathan-ruiz commented May 17, 2021

I think is something like this,
array('name' => $name, 'readAccess'=> true)

got it from the package code here:
src/ObjectStore/v1/Params.php

public function readAccess($type)
    {
        return [
            'location'    => 'header',
            'sentAs'      => sprintf("X-%s-Read", ucfirst($type)),
            'description' => <<<EOT
Sets a container access control list (ACL) that grants read access. Container ACLs are available on any Object Storage
cluster, and are enabled by container rather than by cluster. Specify the ACL value as follows:

".r:*" to allow access for all referrers.

".r:example.com,swift.example.com" to allow access to a comma-separated list of referrers.

".rlistings" to allow container listing.

"AUTH_username" allows access to a specified user who authenticates through a legacy or non-OpenStack-Identity-based
authentication system.

"LDAP_" allows access to all users who authenticate through an LDAP-based legacy or non-OpenStack-Identity-based
authentication system.
EOT
        ];
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants