Ole Christian Langfjæran created AIRFLOW-3895:
-------------------------------------------------
Summary: GoogleCloudStorageHook.create_bucket with optional
request body
Key: AIRFLOW-3895
URL: https://issues.apache.org/jira/browse/AIRFLOW-3895
Project: Apache Airflow
Issue Type: Improvement
Components: hooks
Affects Versions: 1.10.2
Reporter: Ole Christian Langfjæran
When creating a new bucket in Google Cloud Storage,
GoogleCloudStorageHook.create_bucket, I would like to have the option of
supplying missing parameters.
For instance, the field
[lifecycle|https://cloud.google.com/storage/docs/json_api/v1/buckets#lifecycle]
is not available.
My suggestion to supply this is to add an optional dict to the parameters that
gets overwritten with bucket_name, storage_class and collection.
For example like so:
{{def create_bucket(self,}}
{{ bucket_name,}}
{{ resource=None,}}
{{ storage_class='MULTI_REGIONAL',}}
{{ location='US',}}
{{ project_id=None,}}
{{ labels=None):}}
....
{{ service = self.get_conn()}}
{{ bucket_resource = copy.copy(resource)}}
{{ bucket_resource.update({}}
{{ 'name': bucket_name,}}
{{ 'location': location,}}
{{ 'storageClass': storage_class}}
{{ })}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)