示例#1
0
                return

    return gandi.ip.attach(ip, vm, background, force)


@ip.command()
@click.option('--datacenter',
              type=DATACENTER,
              help='Datacenter where the ip will be created.')
@option('--bandwidth',
        type=click.INT,
        default=102400,
        help="Network bandwidth in kbit/s used to create the VM's first "
        "network interface.")
@option('--ip-version',
        type=IntChoice(['4', '6']),
        default=4,
        help='Version of created IP.')
@click.option('--vlan', help='The vlan to which attach this ip if any.')
@click.option('--ip', help='The ip if you try to create a private ip.')
@click.option('--attach', help='The vm you want to attach if any.')
@click.option('--background',
              '--bg',
              default=False,
              is_flag=True,
              help='Run command in background mode (default=False).')
@pass_gandi
def create(gandi, datacenter, bandwidth, ip_version, vlan, ip, attach,
           background):
    """Create a public or private ip
    """
示例#2
0
文件: vm.py 项目: 0k/gandi.cli
    opers = gandi.iaas.delete(resource, background)
    if background:
        for oper in stop_opers + opers:
            output_generic(gandi, oper, output_keys)

    return opers


@cli.command()
@option('--datacenter', type=DATACENTER, default='LU-BI1',
        help='Datacenter where the VM will be spawned.')
@option('--memory', type=click.INT, default=256,
        help='Quantity of RAM in Megabytes to allocate.')
@option('--cores', type=click.INT, default=1,
        help='Number of cpu.')
@click.option('--ip-version', type=IntChoice(['4', '6']), default=None,
              help='Version of created IP.')
@option('--bandwidth', type=click.INT, default=102400,
        help="Network bandwidth in bit/s used to create the VM's first "
             "network interface.")
@click.option('--login', default=None,
              help='Login to create on the VM.')
@click.option('--password', default=False, is_flag=True,
              help='Will ask for a password to be set for the root account '
                   'and the created login.')
@click.option('--hostname', default=None,
              help='Hostname of the VM, will be generated if not provided.')
@option('--image', type=DISK_IMAGE, default='Debian 7 64 bits (HVM)',
        help='Disk image used to boot the VM.')
@click.option('--run', default=None,
              help='Shell command that will run at the first startup of a VM.'
示例#3
0
              help='Common name to use when generating the CSR.')
@click.option('--country',
              required=False,
              help='The generated CSR country (C).')
@click.option('--state', required=False, help='The generated CSR state (ST).')
@click.option('--city', required=False, help='The generated CSR location (L).')
@click.option('--organisation',
              required=False,
              help='The generated CSR organisation (O).')
@click.option('--branch',
              required=False,
              help='The generated CSR branch (OU).')
@click.option('-d',
              '--duration',
              default=1,
              type=IntChoice(['1', '2', '3', '4', '5']),
              help='The certificate duration in year.')
@click.option('--package',
              type=CERTIFICATE_PACKAGE,
              help='Certificate package.')
@click.option('--type',
              type=CERTIFICATE_PACKAGE_TYPE,
              help='Certificate package type (default=std).')
@click.option('--max-altname',
              type=CERTIFICATE_PACKAGE_MAX,
              help='Certificate package max altname number.')
@click.option('--warranty',
              type=CERTIFICATE_PACKAGE_WARRANTY,
              help='Certificate warranty, only good for pro certificates.')
@click.option('--altnames',
              required=False,
示例#4
0
            proceed = click.confirm('Are you sure you want to detach'
                                    ' %s from vm %s' %
                                    (ip_['ip'], iface['vm_id']))
            if not proceed:
                return

    return gandi.ip.attach(ip, vm, background, force)


@cli.command()
@click.option('--datacenter', type=DATACENTER,
              help='Datacenter where the ip will be created.')
@option('--bandwidth', type=click.INT, default=102400,
        help="Network bandwidth in kbit/s used to create the VM's first "
             "network interface.")
@option('--ip-version', type=IntChoice(['4', '6']), default=4,
        help='Version of created IP.')
@click.option('--vlan', help='The vlan to which attach this ip if any.')
@click.option('--ip', help='The ip if you try to create a private ip.')
@click.option('--attach', help='The vm you want to attach if any.')
@click.option('--bg', '--background', default=False, is_flag=True,
              help='Run command in background mode (default=False).')
@pass_gandi
def create(gandi, datacenter, bandwidth, ip_version, vlan, ip, attach,
           background):
    """Create a public or private ip
    """
    if ip_version != 4 and vlan:
        gandi.echo('You must have an --ip-version to 4 when having a vlan.')
        return
示例#5
0
              help='Common name to use when generating the CSR.')
@click.option('--country',
              required=False,
              help='The generated CSR country (C).')
@click.option('--state', required=False, help='The generated CSR state (ST).')
@click.option('--city', required=False, help='The generated CSR location (L).')
@click.option('--organisation',
              required=False,
              help='The generated CSR organisation (O).')
@click.option('--branch',
              required=False,
              help='The generated CSR branch (OU).')
@click.option('-d',
              '--duration',
              default=1,
              type=IntChoice(['1', '2']),
              help='The certificate duration in year.')
@click.option('--package',
              type=CERTIFICATE_PACKAGE,
              help='Certificate package.')
@click.option('--type',
              type=CERTIFICATE_PACKAGE_TYPE,
              help='Certificate package type (default=std).')
@click.option('--max-altname',
              type=CERTIFICATE_PACKAGE_MAX,
              help='Certificate package max altname number.')
@click.option('--warranty',
              type=CERTIFICATE_PACKAGE_WARRANTY,
              help='Certificate warranty, only good for pro certificates.')
@click.option('--altnames',
              required=False,