|
|
@ -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,26 +789,36 @@ 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(
|
|
|
|
|
|
|
|
type='list',
|
|
|
|
|
|
|
|
elements='dict',
|
|
|
|
|
|
|
|
options=dict(
|
|
|
|
bucket=dict(required=True),
|
|
|
|
bucket=dict(required=True),
|
|
|
|
domain=dict(type='str'),
|
|
|
|
domain=dict(type='str'),
|
|
|
|
email=dict(type='str'),
|
|
|
|
email=dict(type='str'),
|
|
|
|
entity=dict(required=True, type='str'),
|
|
|
|
entity=dict(required=True, type='str'),
|
|
|
|
entity_id=dict(type='str'),
|
|
|
|
entity_id=dict(type='str'),
|
|
|
|
id=dict(type='str'),
|
|
|
|
id=dict(type='str'),
|
|
|
|
project_team=dict(type='dict', options=dict(
|
|
|
|
project_team=dict(
|
|
|
|
project_number=dict(type='str'),
|
|
|
|
type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))
|
|
|
|
team=dict(type='str', choices=['editors', 'owners', 'viewers'])
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
role=dict(type='str', choices=['OWNER', 'READER', 'WRITER']),
|
|
|
|
role=dict(type='str', choices=['OWNER', 'READER', 'WRITER'])
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
cors=dict(type='list', elements='dict', options=dict(
|
|
|
|
cors=dict(
|
|
|
|
|
|
|
|
type='list',
|
|
|
|
|
|
|
|
elements='dict',
|
|
|
|
|
|
|
|
options=dict(
|
|
|
|
max_age_seconds=dict(type='int'),
|
|
|
|
max_age_seconds=dict(type='int'),
|
|
|
|
method=dict(type='list', elements='str'),
|
|
|
|
method=dict(type='list', elements='str'),
|
|
|
|
origin=dict(type='list', elements='str'),
|
|
|
|
origin=dict(type='list', elements='str'),
|
|
|
|
response_header=dict(type='list', elements='str')
|
|
|
|
response_header=dict(type='list', elements='str'),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
default_object_acl=dict(type='list', elements='dict', options=dict(
|
|
|
|
),
|
|
|
|
|
|
|
|
default_object_acl=dict(
|
|
|
|
|
|
|
|
type='list',
|
|
|
|
|
|
|
|
elements='dict',
|
|
|
|
|
|
|
|
options=dict(
|
|
|
|
bucket=dict(required=True),
|
|
|
|
bucket=dict(required=True),
|
|
|
|
domain=dict(type='str'),
|
|
|
|
domain=dict(type='str'),
|
|
|
|
email=dict(type='str'),
|
|
|
|
email=dict(type='str'),
|
|
|
@ -818,53 +827,48 @@ def main():
|
|
|
|
generation=dict(type='int'),
|
|
|
|
generation=dict(type='int'),
|
|
|
|
id=dict(type='str'),
|
|
|
|
id=dict(type='str'),
|
|
|
|
object=dict(type='str'),
|
|
|
|
object=dict(type='str'),
|
|
|
|
project_team=dict(type='dict', options=dict(
|
|
|
|
project_team=dict(
|
|
|
|
project_number=dict(type='str'),
|
|
|
|
type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))
|
|
|
|
team=dict(type='str', choices=['editors', 'owners', 'viewers'])
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
role=dict(required=True, type='str', choices=['OWNER', 'READER']),
|
|
|
|
role=dict(required=True, type='str', choices=['OWNER', 'READER'])
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
lifecycle=dict(type='dict', options=dict(
|
|
|
|
lifecycle=dict(
|
|
|
|
rule=dict(type='list', elements='dict', options=dict(
|
|
|
|
type='dict',
|
|
|
|
action=dict(type='dict', options=dict(
|
|
|
|
options=dict(
|
|
|
|
storage_class=dict(type='str'),
|
|
|
|
rule=dict(
|
|
|
|
type=dict(type='str', choices=['Delete', 'SetStorageClass'])
|
|
|
|
type='list',
|
|
|
|
)),
|
|
|
|
elements='dict',
|
|
|
|
condition=dict(type='dict', options=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'),
|
|
|
|
age_days=dict(type='int'),
|
|
|
|
created_before=dict(type='str'),
|
|
|
|
created_before=dict(type='str'),
|
|
|
|
is_live=dict(type='bool'),
|
|
|
|
is_live=dict(type='bool'),
|
|
|
|
matches_storage_class=dict(type='list', elements='str'),
|
|
|
|
matches_storage_class=dict(type='list', elements='str'),
|
|
|
|
num_newer_versions=dict(type='int')
|
|
|
|
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,7 +1040,8 @@ 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'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'),
|
|
|
|
u'domain': item.get('domain'),
|
|
|
|
u'domain': item.get('domain'),
|
|
|
|
u'email': item.get('email'),
|
|
|
|
u'email': item.get('email'),
|
|
|
@ -1044,11 +1049,13 @@ class BucketAclArray(object):
|
|
|
|
u'entityId': item.get('entity_id'),
|
|
|
|
u'entityId': item.get('entity_id'),
|
|
|
|
u'id': item.get('id'),
|
|
|
|
u'id': item.get('id'),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(),
|
|
|
|
u'role': item.get('role')
|
|
|
|
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'bucket': item.get(u'bucket'),
|
|
|
|
u'domain': item.get(u'domain'),
|
|
|
|
u'domain': item.get(u'domain'),
|
|
|
|
u'email': item.get(u'email'),
|
|
|
|
u'email': item.get(u'email'),
|
|
|
@ -1056,8 +1063,9 @@ class BucketAclArray(object):
|
|
|
|
u'entityId': item.get(u'entityId'),
|
|
|
|
u'entityId': item.get(u'entityId'),
|
|
|
|
u'id': item.get(u'id'),
|
|
|
|
u'id': item.get(u'id'),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(),
|
|
|
|
u'role': item.get(u'role')
|
|
|
|
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'maxAgeSeconds': item.get('max_age_seconds'),
|
|
|
|
u'method': item.get('method'),
|
|
|
|
u'method': item.get('method'),
|
|
|
|
u'origin': item.get('origin'),
|
|
|
|
u'origin': item.get('origin'),
|
|
|
|
u'responseHeader': item.get('response_header')
|
|
|
|
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'maxAgeSeconds': item.get(u'maxAgeSeconds'),
|
|
|
|
u'method': item.get(u'method'),
|
|
|
|
u'method': item.get(u'method'),
|
|
|
|
u'origin': item.get(u'origin'),
|
|
|
|
u'origin': item.get(u'origin'),
|
|
|
|
u'responseHeader': item.get(u'responseHeader')
|
|
|
|
u'responseHeader': item.get(u'responseHeader'),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BucketDefaultobjectaclArray(object):
|
|
|
|
class BucketDefaultobjectaclArray(object):
|
|
|
@ -1139,7 +1145,8 @@ 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'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'),
|
|
|
|
u'domain': item.get('domain'),
|
|
|
|
u'domain': item.get('domain'),
|
|
|
|
u'email': item.get('email'),
|
|
|
|
u'email': item.get('email'),
|
|
|
@ -1149,11 +1156,13 @@ class BucketDefaultobjectaclArray(object):
|
|
|
|
u'id': item.get('id'),
|
|
|
|
u'id': item.get('id'),
|
|
|
|
u'object': item.get('object'),
|
|
|
|
u'object': item.get('object'),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(),
|
|
|
|
u'role': item.get('role')
|
|
|
|
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'bucket': item.get(u'bucket'),
|
|
|
|
u'domain': item.get(u'domain'),
|
|
|
|
u'domain': item.get(u'domain'),
|
|
|
|
u'email': item.get(u'email'),
|
|
|
|
u'email': item.get(u'email'),
|
|
|
@ -1163,8 +1172,9 @@ class BucketDefaultobjectaclArray(object):
|
|
|
|
u'id': item.get(u'id'),
|
|
|
|
u'id': item.get(u'id'),
|
|
|
|
u'object': item.get(u'object'),
|
|
|
|
u'object': item.get(u'object'),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(),
|
|
|
|
u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(),
|
|
|
|
u'role': item.get(u'role')
|
|
|
|
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'action': BucketAction(item.get('action', {}), self.module).to_request(),
|
|
|
|
u'condition': BucketCondition(item.get('condition', {}), 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'action': BucketAction(item.get(u'action', {}), self.module).from_response(),
|
|
|
|
u'condition': BucketCondition(item.get(u'condition', {}), 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'age': self.request.get('age_days'),
|
|
|
|
u'createdBefore': self.request.get('created_before'),
|
|
|
|
u'createdBefore': self.request.get('created_before'),
|
|
|
|
u'isLive': self.request.get('is_live'),
|
|
|
|
u'isLive': self.request.get('is_live'),
|
|
|
|
u'matchesStorageClass': self.request.get('matches_storage_class'),
|
|
|
|
u'matchesStorageClass': self.request.get('matches_storage_class'),
|
|
|
|
u'numNewerVersions': self.request.get('num_newer_versions')
|
|
|
|
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'age': self.request.get(u'ageDays'),
|
|
|
|
u'createdBefore': self.request.get(u'createdBefore'),
|
|
|
|
u'createdBefore': self.request.get(u'createdBefore'),
|
|
|
|
u'isLive': self.request.get(u'isLive'),
|
|
|
|
u'isLive': self.request.get(u'isLive'),
|
|
|
|
u'matchesStorageClass': self.request.get(u'matchesStorageClass'),
|
|
|
|
u'matchesStorageClass': self.request.get(u'matchesStorageClass'),
|
|
|
|
u'numNewerVersions': self.request.get(u'numNewerVersions')
|
|
|
|
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__':
|
|
|
|