mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-05 18:30:27 -07:00
Merge pull request #652 from gomesfernandes/fix/bigquery-clustering-fields
fix: google.cloud.gcp_bigquery_table clustering fields
This commit is contained in:
commit
5a395e234f
2 changed files with 19 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- gcp_bigquery_table - properly handle BigQuery table clustering fields
|
|
@ -1169,7 +1169,7 @@ def resource_to_request(module):
|
||||||
request = {
|
request = {
|
||||||
u'kind': 'bigquery#table',
|
u'kind': 'bigquery#table',
|
||||||
u'tableReference': TableTablereference(module.params.get('table_reference', {}), module).to_request(),
|
u'tableReference': TableTablereference(module.params.get('table_reference', {}), module).to_request(),
|
||||||
u'clustering': module.params.get('clustering'),
|
u'clustering': TableClustering(module.params.get('clustering', {}), module).to_request(),
|
||||||
u'description': module.params.get('description'),
|
u'description': module.params.get('description'),
|
||||||
u'friendlyName': module.params.get('friendly_name'),
|
u'friendlyName': module.params.get('friendly_name'),
|
||||||
u'labels': module.params.get('labels'),
|
u'labels': module.params.get('labels'),
|
||||||
|
@ -1247,7 +1247,7 @@ def is_different(module, response):
|
||||||
def response_to_hash(module, response):
|
def response_to_hash(module, response):
|
||||||
return {
|
return {
|
||||||
u'tableReference': TableTablereference(response.get(u'tableReference', {}), module).from_response(),
|
u'tableReference': TableTablereference(response.get(u'tableReference', {}), module).from_response(),
|
||||||
u'clustering': response.get(u'clustering'),
|
u'clustering': TableClustering(response.get(u'clustering', {}), module).from_response(),
|
||||||
u'creationTime': response.get(u'creationTime'),
|
u'creationTime': response.get(u'creationTime'),
|
||||||
u'description': response.get(u'description'),
|
u'description': response.get(u'description'),
|
||||||
u'friendlyName': response.get(u'friendlyName'),
|
u'friendlyName': response.get(u'friendlyName'),
|
||||||
|
@ -1713,5 +1713,20 @@ class TableColumnsArray(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TableClustering(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({'fields': self.request})
|
||||||
|
|
||||||
|
def from_response(self):
|
||||||
|
return remove_nones_from_dict({'fields': self.request})
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue