|
|
@ -18,15 +18,14 @@
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
|
|
|
|
|
|
|
|
__metaclass__ = type
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
################################################################################
|
|
|
|
# Documentation
|
|
|
|
# Documentation
|
|
|
|
################################################################################
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
|
|
|
'status': ["preview"],
|
|
|
|
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
---
|
|
|
@ -790,81 +789,86 @@ def main():
|
|
|
|
module = GcpModule(
|
|
|
|
module = GcpModule(
|
|
|
|
argument_spec=dict(
|
|
|
|
argument_spec=dict(
|
|
|
|
state=dict(default='present', choices=['present', 'absent'], type='str'),
|
|
|
|
state=dict(default='present', choices=['present', 'absent'], type='str'),
|
|
|
|
acl=dict(type='list', elements='dict', options=dict(
|
|
|
|
acl=dict(
|
|
|
|
bucket=dict(required=True),
|
|
|
|
type='list',
|
|
|
|
domain=dict(type='str'),
|
|
|
|
elements='dict',
|
|
|
|
email=dict(type='str'),
|
|
|
|
options=dict(
|
|
|
|
entity=dict(required=True, type='str'),
|
|
|
|
bucket=dict(required=True),
|
|
|
|
entity_id=dict(type='str'),
|
|
|
|
domain=dict(type='str'),
|
|
|
|
id=dict(type='str'),
|
|
|
|
email=dict(type='str'),
|
|
|
|
project_team=dict(type='dict', options=dict(
|
|
|
|
entity=dict(required=True, type='str'),
|
|
|
|
project_number=dict(type='str'),
|
|
|
|
entity_id=dict(type='str'),
|
|
|
|
team=dict(type='str', choices=['editors', 'owners', 'viewers'])
|
|
|
|
id=dict(type='str'),
|
|
|
|
)),
|
|
|
|
project_team=dict(
|
|
|
|
role=dict(type='str', choices=['OWNER', 'READER', 'WRITER'])
|
|
|
|
type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
cors=dict(type='list', elements='dict', options=dict(
|
|
|
|
role=dict(type='str', choices=['OWNER', 'READER', 'WRITER']),
|
|
|
|
max_age_seconds=dict(type='int'),
|
|
|
|
),
|
|
|
|
method=dict(type='list', elements='str'),
|
|
|
|
),
|
|
|
|
origin=dict(type='list', elements='str'),
|
|
|
|
cors=dict(
|
|
|
|
response_header=dict(type='list', elements='str')
|
|
|
|
type='list',
|
|
|
|
)),
|
|
|
|
elements='dict',
|
|
|
|
default_object_acl=dict(type='list', elements='dict', options=dict(
|
|
|
|
options=dict(
|
|
|
|
bucket=dict(required=True),
|
|
|
|
max_age_seconds=dict(type='int'),
|
|
|
|
domain=dict(type='str'),
|
|
|
|
method=dict(type='list', elements='str'),
|
|
|
|
email=dict(type='str'),
|
|
|
|
origin=dict(type='list', elements='str'),
|
|
|
|
entity=dict(required=True, type='str'),
|
|
|
|
response_header=dict(type='list', elements='str'),
|
|
|
|
entity_id=dict(type='str'),
|
|
|
|
),
|
|
|
|
generation=dict(type='int'),
|
|
|
|
),
|
|
|
|
id=dict(type='str'),
|
|
|
|
default_object_acl=dict(
|
|
|
|
object=dict(type='str'),
|
|
|
|
type='list',
|
|
|
|
project_team=dict(type='dict', options=dict(
|
|
|
|
elements='dict',
|
|
|
|
project_number=dict(type='str'),
|
|
|
|
options=dict(
|
|
|
|
team=dict(type='str', choices=['editors', 'owners', 'viewers'])
|
|
|
|
bucket=dict(required=True),
|
|
|
|
)),
|
|
|
|
domain=dict(type='str'),
|
|
|
|
role=dict(required=True, type='str', choices=['OWNER', 'READER'])
|
|
|
|
email=dict(type='str'),
|
|
|
|
)),
|
|
|
|
entity=dict(required=True, type='str'),
|
|
|
|
lifecycle=dict(type='dict', options=dict(
|
|
|
|
entity_id=dict(type='str'),
|
|
|
|
rule=dict(type='list', elements='dict', options=dict(
|
|
|
|
generation=dict(type='int'),
|
|
|
|
action=dict(type='dict', options=dict(
|
|
|
|
id=dict(type='str'),
|
|
|
|
storage_class=dict(type='str'),
|
|
|
|
object=dict(type='str'),
|
|
|
|
type=dict(type='str', choices=['Delete', 'SetStorageClass'])
|
|
|
|
project_team=dict(
|
|
|
|
)),
|
|
|
|
type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))
|
|
|
|
condition=dict(type='dict', options=dict(
|
|
|
|
),
|
|
|
|
age_days=dict(type='int'),
|
|
|
|
role=dict(required=True, type='str', choices=['OWNER', 'READER']),
|
|
|
|
created_before=dict(type='str'),
|
|
|
|
),
|
|
|
|
is_live=dict(type='bool'),
|
|
|
|
),
|
|
|
|
matches_storage_class=dict(type='list', elements='str'),
|
|
|
|
lifecycle=dict(
|
|
|
|
num_newer_versions=dict(type='int')
|
|
|
|
type='dict',
|
|
|
|
))
|
|
|
|
options=dict(
|
|
|
|
))
|
|
|
|
rule=dict(
|
|
|
|
)),
|
|
|
|
type='list',
|
|
|
|
|
|
|
|
elements='dict',
|
|
|
|
|
|
|
|
options=dict(
|
|
|
|
|
|
|
|
action=dict(
|
|
|
|
|
|
|
|
type='dict', options=dict(storage_class=dict(type='str'), type=dict(type='str', choices=['Delete', 'SetStorageClass']))
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
condition=dict(
|
|
|
|
|
|
|
|
type='dict',
|
|
|
|
|
|
|
|
options=dict(
|
|
|
|
|
|
|
|
age_days=dict(type='int'),
|
|
|
|
|
|
|
|
created_before=dict(type='str'),
|
|
|
|
|
|
|
|
is_live=dict(type='bool'),
|
|
|
|
|
|
|
|
matches_storage_class=dict(type='list', elements='str'),
|
|
|
|
|
|
|
|
num_newer_versions=dict(type='int'),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
location=dict(type='str'),
|
|
|
|
location=dict(type='str'),
|
|
|
|
logging=dict(type='dict', options=dict(
|
|
|
|
logging=dict(type='dict', options=dict(log_bucket=dict(type='str'), log_object_prefix=dict(type='str'))),
|
|
|
|
log_bucket=dict(type='str'),
|
|
|
|
|
|
|
|
log_object_prefix=dict(type='str')
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
metageneration=dict(type='int'),
|
|
|
|
metageneration=dict(type='int'),
|
|
|
|
name=dict(type='str'),
|
|
|
|
name=dict(type='str'),
|
|
|
|
owner=dict(type='dict', options=dict(
|
|
|
|
owner=dict(type='dict', options=dict(entity=dict(type='str'), entity_id=dict(type='str'))),
|
|
|
|
entity=dict(type='str'),
|
|
|
|
|
|
|
|
entity_id=dict(type='str')
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
storage_class=dict(type='str', choices=['MULTI_REGIONAL', 'REGIONAL', 'STANDARD', 'NEARLINE', 'COLDLINE', 'DURABLE_REDUCED_AVAILABILITY']),
|
|
|
|
storage_class=dict(type='str', choices=['MULTI_REGIONAL', 'REGIONAL', 'STANDARD', 'NEARLINE', 'COLDLINE', 'DURABLE_REDUCED_AVAILABILITY']),
|
|
|
|
versioning=dict(type='dict', options=dict(
|
|
|
|
versioning=dict(type='dict', options=dict(enabled=dict(type='bool'))),
|
|
|
|
enabled=dict(type='bool')
|
|
|
|
website=dict(type='dict', options=dict(main_page_suffix=dict(type='str'), not_found_page=dict(type='str'))),
|
|
|
|
)),
|
|
|
|
|
|
|
|
website=dict(type='dict', options=dict(
|
|
|
|
|
|
|
|
main_page_suffix=dict(type='str'),
|
|
|
|
|
|
|
|
not_found_page=dict(type='str')
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
project=dict(type='str'),
|
|
|
|
project=dict(type='str'),
|
|
|
|
predefined_default_object_acl=dict(type='str', choices=['authenticatedRead',
|
|
|
|
predefined_default_object_acl=dict(
|
|
|
|
'bucketOwnerFullControl',
|
|
|
|
type='str', choices=['authenticatedRead', 'bucketOwnerFullControl', 'bucketOwnerRead', 'private', 'projectPrivate', 'publicRead']
|
|
|
|
'bucketOwnerRead',
|
|
|
|
),
|
|
|
|
'private',
|
|
|
|
|
|
|
|
'projectPrivate',
|
|
|
|
|
|
|
|
'publicRead'])
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -930,7 +934,7 @@ def resource_to_request(module):
|
|
|
|
u'owner': BucketOwner(module.params.get('owner', {}), module).to_request(),
|
|
|
|
u'owner': BucketOwner(module.params.get('owner', {}), module).to_request(),
|
|
|
|
u'storageClass': module.params.get('storage_class'),
|
|
|
|
u'storageClass': module.params.get('storage_class'),
|
|
|
|
u'versioning': BucketVersioning(module.params.get('versioning', {}), module).to_request(),
|
|
|
|
u'versioning': BucketVersioning(module.params.get('versioning', {}), module).to_request(),
|
|
|
|
u'website': BucketWebsite(module.params.get('website', {}), module).to_request()
|
|
|
|
u'website': BucketWebsite(module.params.get('website', {}), module).to_request(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return_vals = {}
|
|
|
|
return_vals = {}
|
|
|
|
for k, v in request.items():
|
|
|
|
for k, v in request.items():
|
|
|
@ -965,8 +969,8 @@ def return_if_object(module, response, kind, allow_not_found=False):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
module.raise_for_status(response)
|
|
|
|
module.raise_for_status(response)
|
|
|
|
result = response.json()
|
|
|
|
result = response.json()
|
|
|
|
except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst:
|
|
|
|
except getattr(json.decoder, 'JSONDecodeError', ValueError):
|
|
|
|
module.fail_json(msg="Invalid JSON response with error: %s" % inst)
|
|
|
|
module.fail_json(msg="Invalid JSON response with error: %s" % response.text)
|
|
|
|
|
|
|
|
|
|
|
|
if navigate_hash(result, ['error', 'errors']):
|
|
|
|
if navigate_hash(result, ['error', 'errors']):
|
|
|
|
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
|
|
|
|
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
|
|
|
@ -1011,7 +1015,7 @@ def response_to_hash(module, response):
|
|
|
|
u'timeCreated': response.get(u'timeCreated'),
|
|
|
|
u'timeCreated': response.get(u'timeCreated'),
|
|
|
|
u'updated': response.get(u'updated'),
|
|
|
|
u'updated': response.get(u'updated'),
|
|
|
|
u'versioning': BucketVersioning(response.get(u'versioning', {}), module).from_response(),
|
|
|
|
u'versioning': BucketVersioning(response.get(u'versioning', {}), module).from_response(),
|
|
|
|
u'website': BucketWebsite(response.get(u'website', {}), module).from_response()
|
|
|
|
u'website': BucketWebsite(response.get(u'website', {}), module).from_response(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1036,28 +1040,32 @@ class BucketAclArray(object):
|
|
|
|
return items
|
|
|
|
return items
|
|
|
|
|
|
|
|
|
|
|
|
def _request_for_item(self, item):
|
|
|
|
def _request_for_item(self, item):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'),
|
|
|
|
{
|
|
|
|
u'domain': item.get('domain'),
|
|
|
|
u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'),
|
|
|
|
u'email': item.get('email'),
|
|
|
|
u'domain': item.get('domain'),
|
|
|
|
u'entity': item.get('entity'),
|
|
|
|
u'email': item.get('email'),
|
|
|
|
u'entityId': item.get('entity_id'),
|
|
|
|
u'entity': item.get('entity'),
|
|
|
|
u'id': item.get('id'),
|
|
|
|
u'entityId': item.get('entity_id'),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(),
|
|
|
|
u'id': item.get('id'),
|
|
|
|
u'role': item.get('role')
|
|
|
|
u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(),
|
|
|
|
})
|
|
|
|
u'role': item.get('role'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def _response_from_item(self, item):
|
|
|
|
def _response_from_item(self, item):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'bucket': item.get(u'bucket'),
|
|
|
|
{
|
|
|
|
u'domain': item.get(u'domain'),
|
|
|
|
u'bucket': item.get(u'bucket'),
|
|
|
|
u'email': item.get(u'email'),
|
|
|
|
u'domain': item.get(u'domain'),
|
|
|
|
u'entity': item.get(u'entity'),
|
|
|
|
u'email': item.get(u'email'),
|
|
|
|
u'entityId': item.get(u'entityId'),
|
|
|
|
u'entity': item.get(u'entity'),
|
|
|
|
u'id': item.get(u'id'),
|
|
|
|
u'entityId': item.get(u'entityId'),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(),
|
|
|
|
u'id': item.get(u'id'),
|
|
|
|
u'role': item.get(u'role')
|
|
|
|
u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(),
|
|
|
|
})
|
|
|
|
u'role': item.get(u'role'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketProjectteam(object):
|
|
|
|
class BucketProjectteam(object):
|
|
|
@ -1069,16 +1077,10 @@ class BucketProjectteam(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'projectNumber': self.request.get('project_number'), u'team': self.request.get('team')})
|
|
|
|
u'projectNumber': self.request.get('project_number'),
|
|
|
|
|
|
|
|
u'team': self.request.get('team')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'projectNumber': self.request.get(u'projectNumber'), u'team': self.request.get(u'team')})
|
|
|
|
u'projectNumber': self.request.get(u'projectNumber'),
|
|
|
|
|
|
|
|
u'team': self.request.get(u'team')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketCorsArray(object):
|
|
|
|
class BucketCorsArray(object):
|
|
|
@ -1102,20 +1104,24 @@ class BucketCorsArray(object):
|
|
|
|
return items
|
|
|
|
return items
|
|
|
|
|
|
|
|
|
|
|
|
def _request_for_item(self, item):
|
|
|
|
def _request_for_item(self, item):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'maxAgeSeconds': item.get('max_age_seconds'),
|
|
|
|
{
|
|
|
|
u'method': item.get('method'),
|
|
|
|
u'maxAgeSeconds': item.get('max_age_seconds'),
|
|
|
|
u'origin': item.get('origin'),
|
|
|
|
u'method': item.get('method'),
|
|
|
|
u'responseHeader': item.get('response_header')
|
|
|
|
u'origin': item.get('origin'),
|
|
|
|
})
|
|
|
|
u'responseHeader': item.get('response_header'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def _response_from_item(self, item):
|
|
|
|
def _response_from_item(self, item):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'maxAgeSeconds': item.get(u'maxAgeSeconds'),
|
|
|
|
{
|
|
|
|
u'method': item.get(u'method'),
|
|
|
|
u'maxAgeSeconds': item.get(u'maxAgeSeconds'),
|
|
|
|
u'origin': item.get(u'origin'),
|
|
|
|
u'method': item.get(u'method'),
|
|
|
|
u'responseHeader': item.get(u'responseHeader')
|
|
|
|
u'origin': item.get(u'origin'),
|
|
|
|
})
|
|
|
|
u'responseHeader': item.get(u'responseHeader'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketDefaultobjectaclArray(object):
|
|
|
|
class BucketDefaultobjectaclArray(object):
|
|
|
@ -1139,32 +1145,36 @@ class BucketDefaultobjectaclArray(object):
|
|
|
|
return items
|
|
|
|
return items
|
|
|
|
|
|
|
|
|
|
|
|
def _request_for_item(self, item):
|
|
|
|
def _request_for_item(self, item):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'),
|
|
|
|
{
|
|
|
|
u'domain': item.get('domain'),
|
|
|
|
u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'),
|
|
|
|
u'email': item.get('email'),
|
|
|
|
u'domain': item.get('domain'),
|
|
|
|
u'entity': item.get('entity'),
|
|
|
|
u'email': item.get('email'),
|
|
|
|
u'entityId': item.get('entity_id'),
|
|
|
|
u'entity': item.get('entity'),
|
|
|
|
u'generation': item.get('generation'),
|
|
|
|
u'entityId': item.get('entity_id'),
|
|
|
|
u'id': item.get('id'),
|
|
|
|
u'generation': item.get('generation'),
|
|
|
|
u'object': item.get('object'),
|
|
|
|
u'id': item.get('id'),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(),
|
|
|
|
u'object': item.get('object'),
|
|
|
|
u'role': item.get('role')
|
|
|
|
u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(),
|
|
|
|
})
|
|
|
|
u'role': item.get('role'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def _response_from_item(self, item):
|
|
|
|
def _response_from_item(self, item):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'bucket': item.get(u'bucket'),
|
|
|
|
{
|
|
|
|
u'domain': item.get(u'domain'),
|
|
|
|
u'bucket': item.get(u'bucket'),
|
|
|
|
u'email': item.get(u'email'),
|
|
|
|
u'domain': item.get(u'domain'),
|
|
|
|
u'entity': item.get(u'entity'),
|
|
|
|
u'email': item.get(u'email'),
|
|
|
|
u'entityId': item.get(u'entityId'),
|
|
|
|
u'entity': item.get(u'entity'),
|
|
|
|
u'generation': item.get(u'generation'),
|
|
|
|
u'entityId': item.get(u'entityId'),
|
|
|
|
u'id': item.get(u'id'),
|
|
|
|
u'generation': item.get(u'generation'),
|
|
|
|
u'object': item.get(u'object'),
|
|
|
|
u'id': item.get(u'id'),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(),
|
|
|
|
u'object': item.get(u'object'),
|
|
|
|
u'role': item.get(u'role')
|
|
|
|
u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(),
|
|
|
|
})
|
|
|
|
u'role': item.get(u'role'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketProjectteam(object):
|
|
|
|
class BucketProjectteam(object):
|
|
|
@ -1176,16 +1186,10 @@ class BucketProjectteam(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'projectNumber': self.request.get('project_number'), u'team': self.request.get('team')})
|
|
|
|
u'projectNumber': self.request.get('project_number'),
|
|
|
|
|
|
|
|
u'team': self.request.get('team')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'projectNumber': self.request.get(u'projectNumber'), u'team': self.request.get(u'team')})
|
|
|
|
u'projectNumber': self.request.get(u'projectNumber'),
|
|
|
|
|
|
|
|
u'team': self.request.get(u'team')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketLifecycle(object):
|
|
|
|
class BucketLifecycle(object):
|
|
|
@ -1197,14 +1201,10 @@ class BucketLifecycle(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'rule': BucketRuleArray(self.request.get('rule', []), self.module).to_request()})
|
|
|
|
u'rule': BucketRuleArray(self.request.get('rule', []), self.module).to_request()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'rule': BucketRuleArray(self.request.get(u'rule', []), self.module).from_response()})
|
|
|
|
u'rule': BucketRuleArray(self.request.get(u'rule', []), self.module).from_response()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketRuleArray(object):
|
|
|
|
class BucketRuleArray(object):
|
|
|
@ -1228,16 +1228,20 @@ class BucketRuleArray(object):
|
|
|
|
return items
|
|
|
|
return items
|
|
|
|
|
|
|
|
|
|
|
|
def _request_for_item(self, item):
|
|
|
|
def _request_for_item(self, item):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'action': BucketAction(item.get('action', {}), self.module).to_request(),
|
|
|
|
{
|
|
|
|
u'condition': BucketCondition(item.get('condition', {}), self.module).to_request()
|
|
|
|
u'action': BucketAction(item.get('action', {}), self.module).to_request(),
|
|
|
|
})
|
|
|
|
u'condition': BucketCondition(item.get('condition', {}), self.module).to_request(),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def _response_from_item(self, item):
|
|
|
|
def _response_from_item(self, item):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'action': BucketAction(item.get(u'action', {}), self.module).from_response(),
|
|
|
|
{
|
|
|
|
u'condition': BucketCondition(item.get(u'condition', {}), self.module).from_response()
|
|
|
|
u'action': BucketAction(item.get(u'action', {}), self.module).from_response(),
|
|
|
|
})
|
|
|
|
u'condition': BucketCondition(item.get(u'condition', {}), self.module).from_response(),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketAction(object):
|
|
|
|
class BucketAction(object):
|
|
|
@ -1249,16 +1253,10 @@ class BucketAction(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'storageClass': self.request.get('storage_class'), u'type': self.request.get('type')})
|
|
|
|
u'storageClass': self.request.get('storage_class'),
|
|
|
|
|
|
|
|
u'type': self.request.get('type')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'storageClass': self.request.get(u'storageClass'), u'type': self.request.get(u'type')})
|
|
|
|
u'storageClass': self.request.get(u'storageClass'),
|
|
|
|
|
|
|
|
u'type': self.request.get(u'type')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketCondition(object):
|
|
|
|
class BucketCondition(object):
|
|
|
@ -1270,22 +1268,26 @@ class BucketCondition(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'age': self.request.get('age_days'),
|
|
|
|
{
|
|
|
|
u'createdBefore': self.request.get('created_before'),
|
|
|
|
u'age': self.request.get('age_days'),
|
|
|
|
u'isLive': self.request.get('is_live'),
|
|
|
|
u'createdBefore': self.request.get('created_before'),
|
|
|
|
u'matchesStorageClass': self.request.get('matches_storage_class'),
|
|
|
|
u'isLive': self.request.get('is_live'),
|
|
|
|
u'numNewerVersions': self.request.get('num_newer_versions')
|
|
|
|
u'matchesStorageClass': self.request.get('matches_storage_class'),
|
|
|
|
})
|
|
|
|
u'numNewerVersions': self.request.get('num_newer_versions'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict(
|
|
|
|
u'age': self.request.get(u'ageDays'),
|
|
|
|
{
|
|
|
|
u'createdBefore': self.request.get(u'createdBefore'),
|
|
|
|
u'age': self.request.get(u'ageDays'),
|
|
|
|
u'isLive': self.request.get(u'isLive'),
|
|
|
|
u'createdBefore': self.request.get(u'createdBefore'),
|
|
|
|
u'matchesStorageClass': self.request.get(u'matchesStorageClass'),
|
|
|
|
u'isLive': self.request.get(u'isLive'),
|
|
|
|
u'numNewerVersions': self.request.get(u'numNewerVersions')
|
|
|
|
u'matchesStorageClass': self.request.get(u'matchesStorageClass'),
|
|
|
|
})
|
|
|
|
u'numNewerVersions': self.request.get(u'numNewerVersions'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketLogging(object):
|
|
|
|
class BucketLogging(object):
|
|
|
@ -1297,16 +1299,10 @@ class BucketLogging(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'logBucket': self.request.get('log_bucket'), u'logObjectPrefix': self.request.get('log_object_prefix')})
|
|
|
|
u'logBucket': self.request.get('log_bucket'),
|
|
|
|
|
|
|
|
u'logObjectPrefix': self.request.get('log_object_prefix')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'logBucket': self.request.get(u'logBucket'), u'logObjectPrefix': self.request.get(u'logObjectPrefix')})
|
|
|
|
u'logBucket': self.request.get(u'logBucket'),
|
|
|
|
|
|
|
|
u'logObjectPrefix': self.request.get(u'logObjectPrefix')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketOwner(object):
|
|
|
|
class BucketOwner(object):
|
|
|
@ -1318,16 +1314,10 @@ class BucketOwner(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'entity': self.request.get('entity'), u'entityId': self.request.get('entity_id')})
|
|
|
|
u'entity': self.request.get('entity'),
|
|
|
|
|
|
|
|
u'entityId': self.request.get('entity_id')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'entity': self.request.get(u'entity'), u'entityId': self.request.get(u'entityId')})
|
|
|
|
u'entity': self.request.get(u'entity'),
|
|
|
|
|
|
|
|
u'entityId': self.request.get(u'entityId')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketVersioning(object):
|
|
|
|
class BucketVersioning(object):
|
|
|
@ -1339,14 +1329,10 @@ class BucketVersioning(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'enabled': self.request.get('enabled')})
|
|
|
|
u'enabled': self.request.get('enabled')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'enabled': self.request.get(u'enabled')})
|
|
|
|
u'enabled': self.request.get(u'enabled')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketWebsite(object):
|
|
|
|
class BucketWebsite(object):
|
|
|
@ -1358,16 +1344,10 @@ class BucketWebsite(object):
|
|
|
|
self.request = {}
|
|
|
|
self.request = {}
|
|
|
|
|
|
|
|
|
|
|
|
def to_request(self):
|
|
|
|
def to_request(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'mainPageSuffix': self.request.get('main_page_suffix'), u'notFoundPage': self.request.get('not_found_page')})
|
|
|
|
u'mainPageSuffix': self.request.get('main_page_suffix'),
|
|
|
|
|
|
|
|
u'notFoundPage': self.request.get('not_found_page')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_response(self):
|
|
|
|
def from_response(self):
|
|
|
|
return remove_nones_from_dict({
|
|
|
|
return remove_nones_from_dict({u'mainPageSuffix': self.request.get(u'mainPageSuffix'), u'notFoundPage': self.request.get(u'notFoundPage')})
|
|
|
|
u'mainPageSuffix': self.request.get(u'mainPageSuffix'),
|
|
|
|
|
|
|
|
u'notFoundPage': self.request.get(u'notFoundPage')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|