Skip to content

Commit

Permalink
fix the merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
caberos authored and caberos committed Mar 23, 2023
2 parents 83a2c3d + be23dbb commit 6c939d6
Show file tree
Hide file tree
Showing 33 changed files with 261 additions and 568 deletions.
31 changes: 31 additions & 0 deletions SoftLayer/CLI/account/hook_create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Order/create a provisioning script."""
# :license: MIT, see LICENSE for more details.

import click

import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting


@click.command(cls=SoftLayer.CLI.command.SLCommand)
@click.option('--name', '-N', required=True, prompt=True, help="The name of the hook.")
@click.option('--uri', '-U', required=True, prompt=True, help="The endpoint that the script will be downloaded")
@environment.pass_env
def cli(env, name, uri):
"""Order/create a provisioning script."""

manager = SoftLayer.AccountManager(env.client)

provisioning = manager.create_provisioning(name, uri)

table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'r'
table.align['value'] = 'l'

table.add_row(['Id', provisioning.get('id')])
table.add_row(['Name', provisioning.get('name')])
table.add_row(['Created', provisioning.get('createDate')])
table.add_row(['Uri', provisioning.get('uri')])

env.fout(table)
1 change: 0 additions & 1 deletion SoftLayer/CLI/autoscale/__init__.py

This file was deleted.

27 changes: 0 additions & 27 deletions SoftLayer/CLI/autoscale/delete.py

This file was deleted.

93 changes: 0 additions & 93 deletions SoftLayer/CLI/autoscale/detail.py

This file was deleted.

30 changes: 0 additions & 30 deletions SoftLayer/CLI/autoscale/list.py

This file was deleted.

25 changes: 19 additions & 6 deletions SoftLayer/CLI/block/limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,30 @@

@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.option('--sortby', help='Column to sort by', default='Datacenter')
@click.option('--datacenter', '-d', help='Filter by datacenter')
@environment.pass_env
def cli(env, sortby):
def cli(env, sortby, datacenter):
"""List number of block storage volumes limit per datacenter."""
block_manager = SoftLayer.BlockStorageManager(env.client)
block_volumes = block_manager.list_block_volume_limit()

table = formatting.KeyValueTable(DEFAULT_COLUMNS)
table.sortby = sortby
for volume in block_volumes:
datacenter_name = volume['datacenterName']
maximum_available_count = volume['maximumAvailableCount']
provisioned_count = volume['provisionedCount']
table.add_row([datacenter_name, maximum_available_count, provisioned_count])

for volumen in block_volumes:
if datacenter:
if volumen.get('datacenterName') != '':
if volumen.get('datacenterName') == datacenter:
table.add_row([volumen.get('datacenterName'),
volumen.get('maximumAvailableCount'),
volumen.get('provisionedCount')])
break
else:
if volumen.get('datacenterName') != '':
table.add_row([volumen.get('datacenterName'), volumen.get('maximumAvailableCount'),
volumen.get('provisionedCount')])
else:
table.add_row([' - ',
volumen.get('maximumAvailableCount'),
volumen.get('provisionedCount')])
env.fout(table)
24 changes: 18 additions & 6 deletions SoftLayer/CLI/file/limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,29 @@

@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.option('--sortby', help='Column to sort by', default='Datacenter')
@click.option('--datacenter', '-d', help='Filter by datacenter')
@environment.pass_env
def cli(env, sortby):
def cli(env, sortby, datacenter):
"""List number of block storage volumes limit per datacenter."""
file_manager = SoftLayer.FileStorageManager(env.client)
file_volumes = file_manager.list_file_volume_limit()

table = formatting.KeyValueTable(DEFAULT_COLUMNS)
table.sortby = sortby
for volume in file_volumes:
datacenter_name = volume['datacenterName']
maximum_available_count = volume['maximumAvailableCount']
provisioned_count = volume['provisionedCount']
table.add_row([datacenter_name, maximum_available_count, provisioned_count])
for volumen in file_volumes:
if datacenter:
if volumen.get('datacenterName') != '':
if volumen.get('datacenterName') == datacenter:
table.add_row([volumen.get('datacenterName'),
volumen.get('maximumAvailableCount'),
volumen.get('provisionedCount')])
break
else:
if volumen.get('datacenterName') != '':
table.add_row([volumen.get('datacenterName'), volumen.get('maximumAvailableCount'),
volumen.get('provisionedCount')])
else:
table.add_row([' - ',
volumen.get('maximumAvailableCount'),
volumen.get('provisionedCount')])
env.fout(table)
23 changes: 23 additions & 0 deletions SoftLayer/CLI/image/share.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Share an image template with another account."""
# :license: MIT, see LICENSE for more details.

import click

import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import helpers


@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('identifier')
@click.option('--account-id', help='Account Id for another account to share image template', required=True)
@environment.pass_env
def cli(env, identifier, account_id):
"""Share an image template with another account."""

image_mgr = SoftLayer.ImageManager(env.client)
image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image')
shared_image = image_mgr.share_image(image_id, account_id)

if shared_image:
env.fout("Image template {} was shared to account {}.".format(identifier, account_id))
1 change: 1 addition & 0 deletions SoftLayer/CLI/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
('account:orders', 'SoftLayer.CLI.account.orders:cli'),
('account:bandwidth-pools', 'SoftLayer.CLI.account.bandwidth_pools:cli'),
('account:hooks', 'SoftLayer.CLI.account.hooks:cli'),
('account:hook-create', 'SoftLayer.CLI.account.hook_create:cli'),
('account:hook-delete', 'SoftLayer.CLI.account.hook_delete:cli'),

('virtual', 'SoftLayer.CLI.virt'),
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/CLI/virt/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@click.command(cls=SoftLayer.CLI.command.SLCommand, short_help="Capture SoftLayer image.")
@click.argument('identifier')
@click.option('--name', '-n', required=True, help="Name of the image")
@click.option('--all', help="Capture all disks belonging to the VS")
@click.option('--all', is_flag=True, default=False, help="Capture all disks belonging to the VS")
@click.option('--note', help="Add a note to be associated with the image")
@environment.pass_env
def cli(env, identifier, name, all, note):
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:license: MIT, see LICENSE for more details.
"""
VERSION = 'v6.1.4'
VERSION = 'v6.1.5'
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/'
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'
Expand Down
20 changes: 15 additions & 5 deletions SoftLayer/fixtures/SoftLayer_Network_Storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,21 @@
enableSnapshots = True
disableSnapshots = True

getVolumeCountLimits = {
'datacenterName': 'global',
'maximumAvailableCount': 300,
'provisionedCount': 100
}
getVolumeCountLimits = [{
"datacenterName": "global",
"maximumAvailableCount": 700,
"provisionedCount": 2632
},
{
"maximumAvailableCount": 50,
"provisionedCount": 2632
},
{
"datacenterName": "dal13",
"maximumAvailableCount": 52,
"provisionedCount": 30
},
]

refreshDuplicate = {
'dependentDuplicate': 1
Expand Down
7 changes: 7 additions & 0 deletions SoftLayer/fixtures/SoftLayer_Provisioning_Hook.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
createObject = {
'createDate': '2023-03-22T06:37:45-06:00',
'id': 207054,
'name': 'testslcli',
'uri': 'http://slclitest.com',
'hookType': {}
}
deleteObject = True
42 changes: 42 additions & 0 deletions SoftLayer/fixtures/SoftLayer_User_Permission_Action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
getAllObjects = [
{
"key": "T_1",
"keyName": "TICKET_VIEW",
"name": "View Tickets"
},
{
"key": "T_2",
"keyName": "TEST",
"name": "A Testing Permission"
},
{
"key": "T_3",
"keyName": "TEST_3",
"name": "A Testing Permission 3"
},
{
"key": "T_4",
"keyName": "TEST_4",
"name": "A Testing Permission 4"
},
{
"key": "T_5",
"keyName": "ACCESS_ALL_HARDWARE",
"name": "A Testing Permission 5"
},
{
'key': 'ALL_1',
'keyName': 'ACCESS_ALL_HARDWARE',
'name': 'All Hardware Access'
},
{
'key': 'A_1',
'keyName': 'ACCOUNT_SUMMARY_VIEW',
'name': 'View Account Summary'
},
{
'key': 'A_10',
'keyName': 'ADD_SERVICE_STORAGE',
'name': 'Add/Upgrade Storage (StorageLayer)'
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@
{'id': 265592, 'longName': 'Amsterdam 1', 'name': 'ams01', 'statusId': 2},
{'id': 814994, 'longName': 'Amsterdam 3', 'name': 'ams03', 'statusId': 2},
]
permitSharingAccess = True
denySharingAccess = True
Loading

0 comments on commit 6c939d6

Please sign in to comment.