class_docstr: Use the Google Cloud connection to interact with Google Cloud Storage.
class_docstr_tok: ["Use","the","Google","Cloud","connection","to","interact","with","Google","Cloud","Storage","."]
docstr: Creates a new bucket.
  
  Google Cloud Storage uses a flat namespace, so you can't
  create a bucket with a name that is already in use.
  
  .. seealso::
      For more information, see Bucket Naming Guidelines:
      https://cloud.google.com/storage/docs/bucketnaming.html#requirements
  
  :param bucket_name: The name of the bucket.
  :param resource: An optional dict with parameters for creating the bucket.
      For information on available parameters, see Cloud Storage API doc:
      https://cloud.google.com/storage/docs/json_api/v1/buckets/insert
  :param storage_class: This defines how objects in the bucket are stored
      and determines the SLA and the cost of storage. Values include
  
      - ``MULTI_REGIONAL``
      - ``REGIONAL``
      - ``STANDARD``
      - ``NEARLINE``
      - ``COLDLINE``.
  
      If this value is not specified when the bucket is
      created, it will default to STANDARD.
  :param location: The location of the bucket.
      Object data for objects in the bucket resides in physical storage
      within this region. Defaults to US.
  
      .. seealso::
          https://developers.google.com/storage/docs/bucket-locations
  
  :param project_id: The ID of the Google Cloud Project.
  :param labels: User-provided labels, in key/value pairs.
  :return: If successful, it returns the ``id`` of the bucket.
docstr_tok: ["Creates","a","new","bucket",".","Google","Cloud","Storage","uses","a","flat","namespace",",","so","you","can't","create","a","bucket","with","a","name","that","is","already","in","use",".","..","seealso",":",":","For","more","information",",","see","Bucket","Naming","Guidelines",":","https",":","\/\/cloud.google.com\/storage\/docs\/bucketnaming.html","#","requirements",":","param","bucket_name",":","The","name","of","the","bucket",".",":","param","resource",":","An","optional","dict","with","parameters","for","creating","the","bucket",".","For","information","on","available","parameters",",","see","Cloud","Storage","API","doc",":","https",":","\/\/cloud.google.com\/storage\/docs\/json_api\/v1\/buckets\/insert",":","param","storage_class",":","This","defines","how","objects","in","the","bucket","are","stored","and","determines","the","SLA","and","the","cost","of","storage",".","Values","include","-","``","MULTI_REGIONAL","``","-","``","REGIONAL","``","-","``","STANDARD","``","-","``","NEARLINE","``","-","``","COLDLINE","``",".","If","this","value","is","not","specified","when","the","bucket","is","created",",","it","will","default","to","STANDARD",".",":","param","location",":","The","location","of","the","bucket",".","Object","data","for","objects","in","the","bucket","resides","in","physical","storage","within","this","region",".","Defaults","to","US",".","..","seealso",":",":","https",":","\/\/developers.google.com\/storage\/docs\/bucket-locations",":","param","project_id",":","The","ID","of","the","Google","Cloud","Project",".",":","param","labels",":","User-provided","labels",",","in","key\/value","pairs",".",":","return",":","If","successful",",","it","returns","the","``","id","``","of","the","bucket","."]
code: def create_bucket(
      self,
      bucket_name: str,
      resource: dict | None = None,
      storage_class: str = "MULTI_REGIONAL",
      location: str = "US",
      project_id: str | None = None,
      labels: dict | None = None,
  ) -> str:
      """
      Creates a new bucket.
  
      Google Cloud Storage uses a flat namespace, so you can't
      create a bucket with a name that is already in use.
  
      .. seealso::
          For more information, see Bucket Naming Guidelines:
          https://cloud.google.com/storage/docs/bucketnaming.html#requirements
  
      :param bucket_name: The name of the bucket.
      :param resource: An optional dict with parameters for creating the bucket.
          For information on available parameters, see Cloud Storage API doc:
          https://cloud.google.com/storage/docs/json_api/v1/buckets/insert
      :param storage_class: This defines how objects in the bucket are stored
          and determines the SLA and the cost of storage. Values include
  
          - ``MULTI_REGIONAL``
          - ``REGIONAL``
          - ``STANDARD``
          - ``NEARLINE``
          - ``COLDLINE``.
  
          If this value is not specified when the bucket is
          created, it will default to STANDARD.
      :param location: The location of the bucket.
          Object data for objects in the bucket resides in physical storage
          within this region. Defaults to US.
  
          .. seealso::
              https://developers.google.com/storage/docs/bucket-locations
  
      :param project_id: The ID of the Google Cloud Project.
      :param labels: User-provided labels, in key/value pairs.
      :return: If successful, it returns the ``id`` of the bucket.
      """
      self.log.info(
          "Creating Bucket: %s; Location: %s; Storage Class: %s",
          bucket_name,
          location,
          storage_class,
      )
  
      # Add airflow-version label to the bucket
      labels = labels or {}
      labels["airflow-version"] = "v" + version.replace(
          ".", "-"
      ).replace("+", "-")
  
      client = self.get_conn()
      bucket = client.bucket(bucket_name=bucket_name)
      bucket_resource = resource or {}
  
      for item in bucket_resource:
          if item != "name":
              bucket._patch_property(name=item, value=resource[item])  # type: ignore[index]
  
      bucket.storage_class = storage_class
      bucket.labels = labels
      bucket.create(project=project_id, location=location)
      return bucket.id
  
imports: from __future__ import annotations
  import functools
  import gzip
  import json
  import os
  import shutil
  import time
  import warnings
  from contextlib import contextmanager
  from functools import partial
  from io import BytesIO
  from tempfile import NamedTemporaryFile
  from typing import IO, TYPE_CHECKING, Any, Callable, Generator, Sequence, TypeVar, cast, overload
  from urllib.parse import urlsplit
  from gcloud.aio.storage import Storage
  from google.api_core.exceptions import GoogleAPICallError, NotFound
  from google.cloud import storage
  from google.cloud.exceptions import GoogleCloudError
  from google.cloud.storage.retry import DEFAULT_RETRY
  from requests import Session
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
  from airflow.providers.google.cloud.utils.helpers import normalize_directory_path
  from airflow.providers.google.common.consts import CLIENT_INFO
  from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
  from airflow.typing_compat import ParamSpec
  from airflow.utils import timezone
  from airflow.version import version
label_desc: Use image node_id 27 for calling the GCSHook obj's underlying member method code with example usage: obj.create_bucket(bucket_name, resource, storage_class, location, project_id, labels) and returns: bucket