def create_bucket(self, bucket_name, project, kms_key=None, location=None): """Create and return a GCS bucket in a specific project.""" encryption = None if kms_key: encryption = storage.Bucket.EncryptionValue(kms_key) request = storage.StorageBucketsInsertRequest( bucket=storage.Bucket( name=bucket_name, location=location, encryption=encryption), project=project, ) try: return self.client.buckets.Insert(request) except HttpError: return None
def get_bucket(self, bucket): return storage.Bucket(name=bucket, projectNumber=DEFAULT_PROJECT_NUMBER)