mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-06 10:50:28 -07:00
fix: trailing whitespaces and updated documented min python req from 2.6 to 2.7
This commit is contained in:
parent
db55e4afb7
commit
8b88a27cdf
1 changed files with 9 additions and 7 deletions
|
@ -23,9 +23,9 @@ module: gcp_secretmanager_info.py
|
||||||
description:
|
description:
|
||||||
- Gather info for GCP Secret Manager
|
- Gather info for GCP Secret Manager
|
||||||
short_description: Gather info for GCP Secret Manager - List secrets and versions metadata.
|
short_description: Gather info for GCP Secret Manager - List secrets and versions metadata.
|
||||||
author: Tze L. (https://github.com/tl-aiyor)
|
author: Tze L. (https://gitlab.com/tze)
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.7
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options:
|
options:
|
||||||
|
@ -119,12 +119,12 @@ resources:
|
||||||
versions:
|
versions:
|
||||||
description:
|
description:
|
||||||
- An array consists of list of secret version metadata.
|
- An array consists of list of secret version metadata.
|
||||||
- This does not include
|
- This does not include
|
||||||
returned: success
|
returned: success
|
||||||
type: complex
|
type: complex
|
||||||
contains:
|
contains:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The full name of the secret version (e.g., projects/111111111111/secrets/mysecret/versions/1).
|
- The full name of the secret version (e.g., projects/111111111111/secrets/mysecret/versions/1).
|
||||||
type: str
|
type: str
|
||||||
createTime:
|
createTime:
|
||||||
|
@ -141,9 +141,10 @@ resources:
|
||||||
type: str
|
type: str
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(
|
module = GcpModule(argument_spec=dict(
|
||||||
project=dict(default=os.environ['GCP_PROJECT'], type='str')))
|
project=dict(default=os.environ.get('GCP_PROJECT'), type='str')))
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if not module.params['scopes']:
|
||||||
module.params['scopes'] = [
|
module.params['scopes'] = [
|
||||||
|
@ -157,7 +158,7 @@ def main():
|
||||||
results = []
|
results = []
|
||||||
for secret in secrets:
|
for secret in secrets:
|
||||||
secret_versions_url = "https://secretmanager.googleapis.com/v1/{name}/versions".format(
|
secret_versions_url = "https://secretmanager.googleapis.com/v1/{name}/versions".format(
|
||||||
**secret
|
**secret
|
||||||
)
|
)
|
||||||
|
|
||||||
secret['versions'] = fetch_list(secret_versions_url, auth, 'versions')
|
secret['versions'] = fetch_list(secret_versions_url, auth, 'versions')
|
||||||
|
@ -165,10 +166,12 @@ def main():
|
||||||
return_value = {'resources': results}
|
return_value = {'resources': results}
|
||||||
module.exit_json(**return_value)
|
module.exit_json(**return_value)
|
||||||
|
|
||||||
|
|
||||||
def get_secret_metadata(link, auth):
|
def get_secret_metadata(link, auth):
|
||||||
response = auth.get(link)
|
response = auth.get(link)
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
|
|
||||||
def fetch_list(link, auth, array_name):
|
def fetch_list(link, auth, array_name):
|
||||||
return auth.list(link, return_if_object, array_name=array_name)
|
return auth.list(link, return_if_object, array_name=array_name)
|
||||||
|
|
||||||
|
@ -196,4 +199,3 @@ def return_if_object(module, response):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue