"""Authorize File, Block and Portable Storage to a Virtual Server"""
# :license: MIT, see LICENSE for more details.

import click

import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers


@click.command()
@click.argument('identifier')
@click.option('--username-storage', '-u', type=click.STRING,
              help="The storage username to be added to the virtual server")
@click.option('--portable-id', type=click.INT,
              help="The portable storage id to be added to the virtual server")
@environment.pass_env
def cli(env, identifier, username_storage, portable_id):
    """Authorize File, Block and Portable Storage to a Virtual Server."""
    vs = SoftLayer.VSManager(env.client)
    vs_id = helpers.resolve_id(vs.resolve_ids, identifier, 'vs')
    table = formatting.KeyValueTable(['name', 'value'], title="Portable Storage Detail")
    table.align['name'] = 'r'
    table.align['value'] = 'l'

    if username_storage:
        if not vs.authorize_storage(vs_id, username_storage):
            raise exceptions.CLIAbort('Authorize Volume Failed')
        env.fout('Successfully Volume: %s was Added.' % username_storage)
    if portable_id:
        portable_id = helpers.resolve_id(vs.resolve_ids, portable_id, 'storage')
        portable_result = vs.attach_portable_storage(vs_id, portable_id)

        env.fout('Successfully Portable Storage: %i was Added.' % portable_id)

        table.add_row(['Id', portable_result['id']])
        table.add_row(['createDate', portable_result['createDate']])
        env.fout(table)

@@ -759,17 +759,22 @@
 %22%22%0A    v
-s
+irtual
  = SoftL
@@ -805,17 +805,22 @@
 t)%0A    v
-s
+irtual
 _id = he
@@ -829,33 +829,38 @@
 ers.resolve_id(v
-s
+irtual
 .resolve_ids, id
@@ -871,17 +871,22 @@
 fier, 'v
-s
+irtual
 ')%0A    t
@@ -1072,17 +1072,22 @@
 if not v
-s
+irtual
 .authori
@@ -1094,25 +1094,30 @@
 ze_storage(v
-s
+irtual
 _id, usernam
@@ -1329,17 +1329,22 @@
 lve_id(v
-s
+irtual
 .resolve
@@ -1400,17 +1400,22 @@
 sult = v
-s
+irtual
 .attach_
@@ -1432,17 +1432,22 @@
 torage(v
-s
+irtual
 _id, por

Fix tox analysis.