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 name: grafana
version: 0.0.2 version: 0.0.5
readme: README.md readme: README.md

View File

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

View File

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

View File

@ -139,7 +139,12 @@ def main():
module.params['state'])(module) module.params['state'])(module)
if not is_error: 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: else:
module.fail_json(msg=result) module.fail_json(msg=result)

View File

@ -17,7 +17,7 @@ options:
required: true required: true
stack_slug: stack_slug:
description: 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 type: str
required: true required: true
cloud_api_key: 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] choices: [ us, us-azure, eu, au, eu-azure, prod-ap-southeast-0, prod-gb-south-0, prod-eu-west-3]
url: url:
description: 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 type: str
default: https://<stack_slug>.grafana.net default: https://<stack_slug>.grafana.net
org_slug: org_slug:
description: description:
- Name of the organization under which Cloud stack is created. - Name of the organization under which Cloud stack is created.
type: str type: str
required: false required: false
state: state:
@ -177,7 +177,15 @@ def main():
module.params['state'])(module) module.params['state'])(module)
if not is_error: 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: else:
module.fail_json(msg=result) module.fail_json(msg=result)

View File

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

View File

@ -50,7 +50,7 @@ EXAMPLES = '''
''' '''
RETURN = r''' RETURN = r'''
output: output:
description: Dict object containing Data source information description: Dict object containing Data source information
returned: On success returned: On success
type: dict type: dict
@ -85,7 +85,8 @@ def present_datasource(module):
if result.status_code == 200: if result.status_code == 200:
return False, True, result.json() return False, True, result.json()
elif result.status_code == 409: 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']) 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''' RETURN = r'''
output: output:
description: Dict object containing folder information description: Dict object containing folder information
returned: On success returned: On success
type: dict type: dict