Пример #1
0
def create_buckets(project_id, buckets):
    """Create buckets."""
    gsutil = common.Gsutil()
    for bucket in buckets:
        try:
            gsutil.run('defstorageclass', 'get', 'gs://' + bucket)
        except common.GsutilError:
            # Create the bucket if it does not exist.
            gsutil.run('mb', '-p', project_id, 'gs://' + bucket)
Пример #2
0
def create_buckets(project_id, buckets):
    """Create buckets."""
    gsutil = common.Gsutil()
    for bucket in buckets:
        try:
            gsutil.run("defstorageclass", "get", "gs://" + bucket)
        except common.GsutilError:
            # Create the bucket if it does not exist.
            gsutil.run("mb", "-p", project_id, "gs://" + bucket)
Пример #3
0
def set_cors(config_dir, buckets):
    """Sets cors settings."""
    gsutil = common.Gsutil()
    cors_file_path = os.path.join(config_dir, 'gae', 'cors.json')
    for bucket in buckets:
        gsutil.run('cors', 'set', cors_file_path, 'gs://' + bucket)
Пример #4
0
def set_cors(config_dir, buckets):
    """Sets cors settings."""
    gsutil = common.Gsutil()
    cors_file_path = os.path.join(config_dir, "gae", "cors.json")
    for bucket in buckets:
        gsutil.run("cors", "set", cors_file_path, "gs://" + bucket)