Bug fixes for GCP modules (#63153)

pull/63153/merge
The Magician 5 years ago committed by ansibot
parent 1522603078
commit 4959ab5004

@ -200,6 +200,23 @@ options:
required: false
default: US
type: str
default_encryption_configuration:
description:
- The default encryption key for all tables in the dataset. Once this property
is set, all newly-created partitioned tables in the dataset will have encryption
key set to this value, unless table creation request (or query) overrides the
key.
required: false
type: dict
version_added: '2.10'
suboptions:
kms_key_name:
description:
- Describes the Cloud KMS encryption key that will be used to protect destination
BigQuery table. The BigQuery Service Account associated with your project
requires access to this encryption key.
required: true
type: str
project:
description:
- The Google Cloud Platform project to use.
@ -422,6 +439,22 @@ location:
- Changing this forces a new resource to be created.
returned: success
type: str
defaultEncryptionConfiguration:
description:
- The default encryption key for all tables in the dataset. Once this property is
set, all newly-created partitioned tables in the dataset will have encryption
key set to this value, unless table creation request (or query) overrides the
key.
returned: success
type: complex
contains:
kmsKeyName:
description:
- Describes the Cloud KMS encryption key that will be used to protect destination
BigQuery table. The BigQuery Service Account associated with your project
requires access to this encryption key.
returned: success
type: str
'''
################################################################################
@ -467,6 +500,7 @@ def main():
friendly_name=dict(type='str'),
labels=dict(type='dict'),
location=dict(default='US', type='str'),
default_encryption_configuration=dict(type='dict', options=dict(kms_key_name=dict(required=True, type='str'))),
)
)
@ -528,6 +562,9 @@ def resource_to_request(module):
u'friendlyName': module.params.get('friendly_name'),
u'labels': module.params.get('labels'),
u'location': module.params.get('location'),
u'defaultEncryptionConfiguration': DatasetDefaultencryptionconfiguration(
module.params.get('default_encryption_configuration', {}), module
).to_request(),
}
return_vals = {}
for k, v in request.items():
@ -606,6 +643,7 @@ def response_to_hash(module, response):
u'labels': response.get(u'labels'),
u'lastModifiedTime': response.get(u'lastModifiedTime'),
u'location': response.get(u'location'),
u'defaultEncryptionConfiguration': DatasetDefaultencryptionconfiguration(response.get(u'defaultEncryptionConfiguration', {}), module).from_response(),
}
@ -688,5 +726,20 @@ class DatasetDatasetreference(object):
return remove_nones_from_dict({u'datasetId': self.request.get(u'datasetId'), u'projectId': self.request.get(u'projectId')})
class DatasetDefaultencryptionconfiguration(object):
def __init__(self, request, module):
self.module = module
if request:
self.request = request
else:
self.request = {}
def to_request(self):
return remove_nones_from_dict({u'kmsKeyName': self.request.get('kms_key_name')})
def from_response(self):
return remove_nones_from_dict({u'kmsKeyName': self.request.get(u'kmsKeyName')})
if __name__ == '__main__':
main()

@ -280,6 +280,22 @@ resources:
- Changing this forces a new resource to be created.
returned: success
type: str
defaultEncryptionConfiguration:
description:
- The default encryption key for all tables in the dataset. Once this property
is set, all newly-created partitioned tables in the dataset will have encryption
key set to this value, unless table creation request (or query) overrides
the key.
returned: success
type: complex
contains:
kmsKeyName:
description:
- Describes the Cloud KMS encryption key that will be used to protect destination
BigQuery table. The BigQuery Service Account associated with your project
requires access to this encryption key.
returned: success
type: str
'''
################################################################################

Loading…
Cancel
Save