File: delete.py

package info (click to toggle)
python-softlayer 6.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,100 kB
  • sloc: python: 53,771; makefile: 289; sh: 57
file content (27 lines) | stat: -rw-r--r-- 766 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Delete autoscale."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer

from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.managers.autoscale import AutoScaleManager


@click.command(cls=SLCommand)
@click.argument('identifier')
@environment.pass_env
def cli(env, identifier):
    """Delete this group and destroy all members of it.

    Example: slcli autoscale delete autoscaleId

    """

    autoscale = AutoScaleManager(env.client)

    try:
        autoscale.delete(identifier)
        click.secho("%s deleted successfully" % identifier, fg='green')
    except SoftLayer.SoftLayerAPIError as ex:
        click.secho("Failed to delete %s\n%s" % (identifier, ex), fg='red')