mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-17 08:21:22 -07:00
adding more specific metrics (#302)
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
5b92781ab0
commit
c946e77783
2 changed files with 19 additions and 4 deletions
plugins
|
@ -36,6 +36,12 @@ options:
|
||||||
description:
|
description:
|
||||||
- Array of scopes to be used.
|
- Array of scopes to be used.
|
||||||
type: list
|
type: list
|
||||||
|
env_type:
|
||||||
|
description:
|
||||||
|
- Specifies which Ansible environment you're running this module within.
|
||||||
|
- This should not be set unless you know what you're doing.
|
||||||
|
- This only alters the User Agent string for any API requests.
|
||||||
|
type: str
|
||||||
notes:
|
notes:
|
||||||
- for authentication, you can set service_account_file using the
|
- for authentication, you can set service_account_file using the
|
||||||
c(gcp_service_account_file) env variable.
|
c(gcp_service_account_file) env variable.
|
||||||
|
|
|
@ -165,9 +165,14 @@ class GcpSession(object):
|
||||||
self.module.fail_json(msg="Credential type '%s' not implemented" % cred_type)
|
self.module.fail_json(msg="Credential type '%s' not implemented" % cred_type)
|
||||||
|
|
||||||
def _headers(self):
|
def _headers(self):
|
||||||
return {
|
if self.module.params.get('env_type'):
|
||||||
'User-Agent': "Google-Ansible-MM-{0}".format(self.product)
|
return {
|
||||||
}
|
'User-Agent': "Google-Ansible-MM-{0}-{1}".format(self.product, self.module.params.get('env_type'))
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return {
|
||||||
|
'User-Agent': "Google-Ansible-MM-{0}".format(self.product)
|
||||||
|
}
|
||||||
|
|
||||||
def _merge_dictionaries(self, a, b):
|
def _merge_dictionaries(self, a, b):
|
||||||
new = a.copy()
|
new = a.copy()
|
||||||
|
@ -208,7 +213,11 @@ class GcpModule(AnsibleModule):
|
||||||
scopes=dict(
|
scopes=dict(
|
||||||
required=False,
|
required=False,
|
||||||
fallback=(env_fallback, ['GCP_SCOPES']),
|
fallback=(env_fallback, ['GCP_SCOPES']),
|
||||||
type='list')
|
type='list'),
|
||||||
|
env_type=dict(
|
||||||
|
required=False,
|
||||||
|
fallback=(env_fallback, ['GCP_ENV_TYPE']),
|
||||||
|
type='str')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue