Skip to content

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

Description

@amarvora

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

Activity

  1. jonathan-ruiz commented on May 17, 2021

    @jonathan-ruiz

    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

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