Exemplo n.º 1
0
def cli(env, identifier, credential_id):
    """Delete the credential of an Object Storage Account."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    credential = mgr.delete_credential(identifier, credential_id=credential_id)

    env.fout(credential)
Exemplo n.º 2
0
def cli(env, identifier, credential_id):
    """Delete the credential of an Object Storage Account."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    storage_id = helpers.resolve_id(mgr.resolve_ids, identifier,
                                    'Object Storage')
    credential = mgr.delete_credential(storage_id, credential_id=credential_id)

    env.fout(credential)
Exemplo n.º 3
0
def cli(env, identifier):
    """Credential limits for this IBM Cloud Object Storage account."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    credential_limit = mgr.limit_credential(identifier)
    table = formatting.Table(['limit'])
    table.add_row([
        credential_limit,
    ])

    env.fout(table)
Exemplo n.º 4
0
def cli(env, identifier):
    """Credential limits for this IBM Cloud Object Storage account."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    storage_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'Object Storage')
    credential_limit = mgr.limit_credential(storage_id)
    table = formatting.Table(['limit'])
    table.add_row([
        credential_limit,
    ])

    env.fout(table)
Exemplo n.º 5
0
def cli(env):
    """List object storage accounts."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    accounts = mgr.list_accounts()
    table = formatting.Table(['id', 'name'])
    table.sortby = 'id'
    for account in accounts:
        table.add_row([
            account['id'],
            account['username'],
        ])

    env.fout(table)
Exemplo n.º 6
0
def cli(env, identifier):
    """Retrieve credentials used for generating an AWS signature. Max of 2."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    credential_list = mgr.list_credential(identifier)
    table = formatting.Table(['id', 'password', 'username', 'type_name'])

    for credential in credential_list:
        table.add_row([
            credential['id'], credential['password'], credential['username'],
            credential['type']['name']
        ])

    env.fout(table)
def cli(env):
    """List object storage endpoints."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    endpoints = mgr.list_endpoints()

    table = formatting.Table(['datacenter', 'public', 'private'])
    for endpoint in endpoints:
        table.add_row([
            endpoint['datacenter']['name'],
            endpoint['public'],
            endpoint['private'],
        ])

    env.fout(table)
Exemplo n.º 8
0
def cli(env, identifier):
    """Create credentials for an IBM Cloud Object Storage Account"""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    credential = mgr.create_credential(identifier)
    table = formatting.Table(['id', 'password', 'username', 'type_name'])
    table.sortby = 'id'
    table.add_row([
        credential['id'],
        credential['password'],
        credential['username'],
        credential['type']['name']
    ])

    env.fout(table)
Exemplo n.º 9
0
def cli(env, identifier):
    """Create credentials for an IBM Cloud Object Storage Account"""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    storage_id = helpers.resolve_id(mgr.resolve_ids, identifier,
                                    'Object Storage')
    credential = mgr.create_credential(storage_id)
    table = formatting.Table(['id', 'password', 'username', 'type_name'])
    table.sortby = 'id'
    table.add_row([
        credential.get('id'),
        credential.get('password'),
        credential.get('username'),
        credential.get('type', {}).get('name')
    ])

    env.fout(table)
Exemplo n.º 10
0
def cli(env, identifier):
    """Retrieve credentials used for generating an AWS signature. Max of 2."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    storage_id = helpers.resolve_id(mgr.resolve_ids, identifier,
                                    'Object Storage')
    credential_list = mgr.list_credential(storage_id)

    table = formatting.Table(['id', 'password', 'username', 'type_name'])

    for credential in credential_list:
        table.add_row([
            credential.get('id'),
            credential.get('password'),
            credential.get('username'),
            credential.get('type', {}).get('name')
        ])

    env.fout(table)
Exemplo n.º 11
0
def cli(env, limit):
    """List object storage accounts."""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    accounts = mgr.list_accounts(limit=limit)
    table = formatting.Table(['id', 'name', 'apiType'])
    table.sortby = 'id'
    api_type = None
    for account in accounts:
        if 'vendorName' in account and account['vendorName'] == 'Swift':
            api_type = 'Swift'
        elif 'Cleversafe' in account['serviceResource']['name']:
            api_type = 'S3'

        table.add_row([
            account['id'],
            account['username'],
            api_type,
        ])

    env.fout(table)
Exemplo n.º 12
0
 def set_up(self):
     self.object_storage = SoftLayer.ObjectStorageManager(self.client)