This commit is contained in:
Ishan Jain 2022-08-10 16:13:04 +05:30
parent ed27d56912
commit 788b882c8d
16 changed files with 1035 additions and 18 deletions

View File

View File

View File

View File

View File

View File

1003
docs/folder_module.rst Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ namespace: grafana
name: grafana
version: 0.0.2
version: 0.0.5
readme: README.md

View File

@ -40,12 +40,12 @@ options:
required: true
groupInterval:
description:
- The waiting time to send a batch of new alerts for that group after the first notification was sent. If empty it will be inherited from the parent policy.
- The wait time to send a batch of new alerts for that group after the first notification was sent. Inherited from the parent policy if empty.
type: str
default: 5m
groupWait:
description:
- The waiting time until the initial notification is sent for a new group created by an incoming alert. If empty it will be inherited from the parent policy.
- The wait time until the initial notification is sent for a new group created by an incoming alert. Inherited from the parent policy if empty.
type: str
default: 30s
objectMatchers:

View File

@ -139,7 +139,12 @@ def main():
module.params['state'])(module)
if not is_error:
module.exit_json(changed=has_changed, pluginId=result['pluginId'], pluginName=result['pluginName'], pluginSlug=result['pluginSlug'], current_version=result['version'], latest_version=result['latestVersion'])
module.exit_json(changed=has_changed,
pluginId=result['pluginId'],
pluginName=result['pluginName'],
pluginSlug=result['pluginSlug'],
current_version=result['version'],
latest_version=result['latestVersion'])
else:
module.fail_json(msg=result)

View File

@ -17,7 +17,7 @@ options:
required: true
stack_slug:
description:
- Subdomain that the Grafana instance will be available at. For example, if you set the slug to <stack_slug>, the instance will be available at https://<stack_slug>.grafana.net
- Subdomain of the Grafana instance. For example, if slug is <stack_slug>, the instance URL will be https://<stack_slug>.grafana.net
type: str
required: true
cloud_api_key:
@ -177,7 +177,15 @@ def main():
module.params['state'])(module)
if not is_error:
module.exit_json(changed=has_changed, alertmanager_name=result['amInstanceName'], url=result['url'], id=result['id'], cluster_slug=result['clusterName'], orgID=result['orgId'], loki_url=result['hlInstanceUrl'], prometheus_url=result['hmInstancePromUrl'], tempo_url=result['htInstanceUrl'], alertmanager_url=result['amInstanceUrl'])
module.exit_json(changed=has_changed,
alertmanager_name=result['amInstanceName'],
url=result['url'], id=result['id'],
cluster_slug=result['clusterName'],
orgID=result['orgId'],
loki_url=result['hlInstanceUrl'],
prometheus_url=result['hmInstancePromUrl'],
tempo_url=result['htInstanceUrl'],
alertmanager_url=result['amInstanceUrl'])
else:
module.fail_json(msg=result)

View File

@ -85,7 +85,8 @@ def present_datasource(module):
if result.status_code == 200:
return False, True, result.json()
elif result.status_code == 409:
get_id_url = requests.get('https://' + module.params['stack_slug'] + '.grafana.net/api/datasources/id/' + module.params['datasource']['name'], headers={"Authorization": 'Bearer ' + module.params['cloud_api_key']})
get_id_url = requests.get('https://' + module.params['stack_slug'] + '.grafana.net/api/datasources/id/' + module.params['datasource']['name'],
headers={"Authorization": 'Bearer ' + module.params['cloud_api_key']})
api_url = 'https://' + module.params['stack_slug'] + '.grafana.net/api/datasources/' + str(get_id_url.json()['id'])