|
4 | 4 |
|
5 | 5 |
|
6 | 6 | @click.command('blackout', short_help='Suppress alerts') |
7 | | -@click.option('--environment', '-E', metavar='ENVIRONMENT') |
8 | | -@click.option('--service', '-S', metavar='SERVICE', multiple=True) |
9 | | -@click.option('--resource', '-r', metavar='RESOURCE') |
10 | | -@click.option('--event', '-e', metavar='EVENT') |
11 | | -@click.option('--group', '-g', metavar='GROUP') |
12 | | -@click.option('--tag', '-T', 'tags', metavar='TAG', multiple=True) |
13 | | -@click.option('--start', metavar='DATETIME') |
14 | | -@click.option('--duration', metavar='EXPIRES') |
| 7 | +@click.option('--environment', '-E', metavar='ENVIRONMENT', help='Environment eg. Production, Development') |
| 8 | +@click.option('--service', '-S', metavar='SERVICE', multiple=True, help='List of affected services eg. app name, Web, Network, Storage, Database, Security') |
| 9 | +@click.option('--resource', '-r', metavar='RESOURCE', help='Resource under alarm') |
| 10 | +@click.option('--event', '-e', metavar='EVENT', help='Event name') |
| 11 | +@click.option('--group', '-g', metavar='GROUP', help='Group event by type eg. OS, Performance') |
| 12 | +@click.option('--tag', '-T', 'tags', multiple=True, metavar='TAG', help='List of tags eg. London, os:linux, AWS/EC2') |
| 13 | +@click.option('--customer', metavar='STRING', help='Customer (Admin only)') |
| 14 | +@click.option('--start', metavar='DATETIME', help='Start time in ISO8601 eg. 2018-02-01T12:00:00.000Z') |
| 15 | +@click.option('--duration', metavar='SECONDS', type=int, help='Blackout period in seconds') |
15 | 16 | @click.option('--delete', '-D', help='Delete blackout using ID') |
16 | 17 | @click.pass_obj |
17 | | -def cli(obj, environment, service, resource, event, group, tags, start, duration, delete): |
| 18 | +def cli(obj, environment, service, resource, event, group, tags, customer, start, duration, delete): |
18 | 19 | """Suppress alerts for specified duration based on alert attributes.""" |
19 | 20 | client = obj['client'] |
20 | 21 | if delete: |
21 | | - if environment or service or resource or event or group or tags or start or duration: |
22 | | - raise click.UsageError('Option "--delete" is mutually exclusive.') |
23 | 22 | client.delete_blackout(delete) |
24 | 23 | else: |
25 | 24 | if not environment: |
26 | 25 | raise click.UsageError('Missing option "--environment" / "-E".') |
27 | 26 | try: |
28 | | - blackout = client.create_blackout(environment, service, resource, event, group, tags, start, duration) |
| 27 | + blackout = client.create_blackout( |
| 28 | + environment=environment, |
| 29 | + service=service, |
| 30 | + resource=resource, |
| 31 | + event=event, |
| 32 | + group=group, |
| 33 | + tags=tags, |
| 34 | + customer=customer, |
| 35 | + start=start, |
| 36 | + duration=duration |
| 37 | + ) |
29 | 38 | except Exception as e: |
30 | 39 | click.echo('ERROR: {}'.format(e)) |
31 | 40 | sys.exit(1) |
|
0 commit comments