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

@ -17,7 +17,7 @@ options:
required: true
uid:
description:
- Sets the UID of the Contact point.
- Sets the UID of the Contact point.
type: str
required: true
type:
@ -75,7 +75,7 @@ EXAMPLES = '''
'''
RETURN = r'''
output:
output:
description: Dict object containing Contact point information information
returned: On success
type: dict

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:
@ -57,7 +57,7 @@ options:
repeatInterval:
description:
- The waiting time to resend an alert after they have successfully been sent.
type: str
type: str
default: 4h
stack_slug:
description:
@ -82,7 +82,7 @@ EXAMPLES = '''
object_matchers: [["env", "=", "Production"]],
}
]
- name: Set nested Notification policies
alert_notification_policy:
routes: [
@ -106,7 +106,7 @@ EXAMPLES = '''
'''
RETURN = r'''
output:
output:
description: Dict object containing Notification tree information
returned: On success
type: dict
@ -120,7 +120,7 @@ output:
returned: on success
type: str
provenance:
description:
description:
returned: on success
type: str
receiver:

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:
@ -33,12 +33,12 @@ options:
choices: [ us, us-azure, eu, au, eu-azure, prod-ap-southeast-0, prod-gb-south-0, prod-eu-west-3]
url:
description:
- If you use a custom domain for the instance, you can provide it here. For example, https://grafana.yourdoman.io.
- If you use a custom domain for the instance, you can provide it here. For example, https://grafana.yourdoman.io.
type: str
default: https://<stack_slug>.grafana.net
org_slug:
description:
- Name of the organization under which Cloud stack is created.
- Name of the organization under which Cloud stack is created.
type: str
required: false
state:
@ -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

@ -50,7 +50,7 @@ EXAMPLES = '''
'''
RETURN = r'''
output:
output:
description: Dict object containing folder information
returned: On success
type: dict

View File

@ -50,7 +50,7 @@ EXAMPLES = '''
'''
RETURN = r'''
output:
output:
description: Dict object containing Data source information
returned: On success
type: dict
@ -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'])

View File

@ -58,7 +58,7 @@ EXAMPLES = '''
'''
RETURN = r'''
output:
output:
description: Dict object containing folder information
returned: On success
type: dict