# -*- coding: utf-8 -*- # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Implementation of mb command for creating cloud storage buckets.""" from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals import re import textwrap from gslib.cloud_api import AccessDeniedException, BadRequestException from gslib.command import Command from gslib.command_argument import CommandArgument from gslib.commands.rpo import VALID_RPO_VALUES from gslib.commands.rpo import VALID_RPO_VALUES_STRING from gslib.cs_api_map import ApiSelector from gslib.exception import CommandException from gslib.exception import InvalidUrlError from gslib.storage_url import StorageUrlFromString from gslib.third_party.storage_apitools import storage_v1_messages as apitools_messages from gslib.utils.constants import NO_MAX from gslib.utils.retention_util import RetentionInSeconds from gslib.utils.shim_util import GcloudStorageFlag from gslib.utils.shim_util import GcloudStorageMap from gslib.utils.text_util import InsistAscii from gslib.utils.text_util import InsistOnOrOff from gslib.utils.text_util import NormalizeStorageClass from gslib.utils.encryption_helper import ValidateCMEK _SYNOPSIS = """ gsutil mb [-b (on|off)] [-c ] [-k ] [-l ] [-p ] [--autoclass] [--retention