From 240d4286e6b7fa3a0f195bc6f233b3a2892e4d2b Mon Sep 17 00:00:00 2001 From: Will Beebe Date: Mon, 28 Oct 2019 18:26:06 +0000 Subject: [PATCH] Adding "name" to Cloud Build resource Signed-off-by: Modular Magician --- plugins/modules/gcp_cloudbuild_trigger.py | 19 +++++++++++++++---- .../modules/gcp_cloudbuild_trigger_info.py | 5 +++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/plugins/modules/gcp_cloudbuild_trigger.py b/plugins/modules/gcp_cloudbuild_trigger.py index 7e9c3b3..f7d9510 100644 --- a/plugins/modules/gcp_cloudbuild_trigger.py +++ b/plugins/modules/gcp_cloudbuild_trigger.py @@ -53,6 +53,12 @@ options: - The unique identifier for the trigger. required: false type: str + name: + description: + - Name of the trigger. Must be unique within the project. + required: false + type: str + version_added: '2.10' description: description: - Human-readable description of the trigger. @@ -370,6 +376,11 @@ id: - The unique identifier for the trigger. returned: success type: str +name: + description: + - Name of the trigger. Must be unique within the project. + returned: success + type: str description: description: - Human-readable description of the trigger. @@ -629,6 +640,7 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), id=dict(type='str'), + name=dict(type='str'), description=dict(type='str'), disabled=dict(type='bool'), substitutions=dict(type='dict'), @@ -679,10 +691,7 @@ def main(): state = module.params['state'] - if module.params['id']: - fetch = fetch_resource(module, self_link(module)) - else: - fetch = {} + fetch = fetch_resource(module, self_link(module)) changed = False if fetch: @@ -725,6 +734,7 @@ def delete(module, link): def resource_to_request(module): request = { u'id': module.params.get('id'), + u'name': module.params.get('name'), u'description': module.params.get('description'), u'disabled': module.params.get('disabled'), u'substitutions': module.params.get('substitutions'), @@ -799,6 +809,7 @@ def is_different(module, response): def response_to_hash(module, response): return { u'id': response.get(u'id'), + u'name': response.get(u'name'), u'description': response.get(u'description'), u'disabled': response.get(u'disabled'), u'createTime': response.get(u'createTime'), diff --git a/plugins/modules/gcp_cloudbuild_trigger_info.py b/plugins/modules/gcp_cloudbuild_trigger_info.py index db8c87f..10764da 100644 --- a/plugins/modules/gcp_cloudbuild_trigger_info.py +++ b/plugins/modules/gcp_cloudbuild_trigger_info.py @@ -109,6 +109,11 @@ resources: - The unique identifier for the trigger. returned: success type: str + name: + description: + - Name of the trigger. Must be unique within the project. + returned: success + type: str description: description: - Human-readable description of the trigger.