Skip to content

Commit 5e63048

Browse files
author
Clark Perkins
committed
Removed search_* methods, just pass kwargs to list_* methods instead
1 parent 1cc82c4 commit 5e63048

File tree

9 files changed

+16
-49
lines changed

9 files changed

+16
-49
lines changed

stackdio/cli/mixins/blueprints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def create_all_blueprints(client):
181181

182182

183183
def get_blueprint_id(client, blueprint_title):
184-
found_blueprints = client.search_blueprints(title=blueprint_title)
184+
found_blueprints = client.list_blueprints(title=blueprint_title)
185185

186186
if len(found_blueprints) == 0:
187187
raise click.Abort('Blueprint "{0}" does not exist'.format(blueprint_title))

stackdio/cli/mixins/formulas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def import_formula(client, uri, username, password):
4343

4444

4545
def get_formula_id(client, formula_uri):
46-
found_formulas = client.search_formulas(uri=formula_uri)
46+
found_formulas = client.list_formulas(uri=formula_uri)
4747

4848
if len(found_formulas) == 0:
4949
raise click.Abort('Formula "{0}" does not exist'.format(formula_uri))

stackdio/cli/mixins/stacks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def launch_stack(client, blueprint_title, stack_title):
5252

5353

5454
def get_stack_id(client, stack_title):
55-
found_stacks = client.search_stacks(title=stack_title)
55+
found_stacks = client.list_stacks(title=stack_title)
5656

5757
if len(found_stacks) == 0:
5858
raise click.Abort('Stack "{0}" does not exist'.format(stack_title))
@@ -73,7 +73,7 @@ def stack_history(client, stack_title, length):
7373
stack_id = get_stack_id(client, stack_title)
7474
history = client.get_stack_history(stack_id)
7575
for event in history[0:min(length, len(history))]:
76-
click.echo('[{created}] {level} // {event} // {status}'.format(**event))
76+
click.echo('[{created}] {message}'.format(**event))
7777

7878

7979
@stacks.command(name='hostnames')

stackdio/client/account.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@
2121
class AccountMixin(HttpMixin):
2222

2323
@get('cloud/providers/', paginate=True)
24-
def list_providers(self):
24+
def list_providers(self, **kwargs):
2525
"""List all providers"""
2626
pass
2727

28-
@get('cloud/providers/', paginate=True)
29-
def search_providers(self, **kwargs):
30-
"""Search for a provider"""
31-
pass
32-
3328
@post('cloud/accounts/')
3429
def create_account(self, **kwargs):
3530
"""Create an account"""
@@ -53,7 +48,7 @@ def create_account(self, **kwargs):
5348
return form_data
5449

5550
@get('cloud/accounts/', paginate=True)
56-
def list_accounts(self):
51+
def list_accounts(self, **kwargs):
5752
"""List all account"""
5853
pass
5954

@@ -62,11 +57,6 @@ def get_account(self, account_id):
6257
"""Return the account that matches the given id"""
6358
pass
6459

65-
@get('cloud/accounts/')
66-
def search_accounts(self, **kwargs):
67-
"""List all accounts"""
68-
pass
69-
7060
@delete('cloud/accounts/{account_id}/')
7161
def delete_account(self, account_id):
7262
"""List all accounts"""

stackdio/client/blueprint.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,13 @@ def create_blueprint(self, blueprint):
5656
return blueprint
5757

5858
@get('blueprints/', paginate=True)
59-
def list_blueprints(self):
59+
def list_blueprints(self, **kwargs):
6060
pass
6161

6262
@get('blueprints/{blueprint_id}/')
6363
def get_blueprint(self, blueprint_id):
6464
pass
6565

66-
@get('blueprints/', paginate=True)
67-
def search_blueprints(self, **kwargs):
68-
pass
69-
7066
@delete('blueprints/{blueprint_id}/')
7167
def delete_blueprint(self, blueprint_id):
7268
pass

stackdio/client/formula.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def import_formula(self, formula_uri, git_username=None, git_password=None, acce
3737
return data
3838

3939
@get('formulas/', paginate=True)
40-
def list_formulas(self):
40+
def list_formulas(self, **kwargs):
4141
"""Return all formulas"""
4242
pass
4343

@@ -50,11 +50,6 @@ def get_formula(self, formula_id):
5050
def list_components_for_version(self, formula_id, version):
5151
pass
5252

53-
@get('formulas/', paginate=True)
54-
def search_formulas(self, **kwargs):
55-
"""Get a formula with matching id"""
56-
pass
57-
5853
@delete('formulas/{formula_id}/')
5954
def delete_formula(self, formula_id):
6055
"""Delete formula with matching id"""

stackdio/client/image.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_image(self, title, image_id, ssh_user, cloud_provider, default_instan
3232
}
3333

3434
@get('cloud/images/', paginate=True)
35-
def list_images(self):
35+
def list_images(self, **kwargs):
3636
"""List all images"""
3737
pass
3838

@@ -41,11 +41,6 @@ def get_image(self, image_id):
4141
"""Return the image that matches the given id"""
4242
pass
4343

44-
@get('cloud/images/', paginate=True)
45-
def search_images(self, **kwargs):
46-
"""List all images"""
47-
pass
48-
4944
@delete('cloud/images/{image_id}/')
5045
def delete_image(self, image_id):
5146
"""Delete the image with the given id"""

stackdio/client/region.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,17 @@
2020

2121
class RegionMixin(HttpMixin):
2222
@get('cloud/providers/{provider_name}/regions/', paginate=True)
23-
def list_regions(self, provider_name):
23+
def list_regions(self, provider_name, **kwargs):
2424
pass
2525

2626
@get('cloud/providers/{provider_name}/regions/{region_id}/')
2727
def get_region(self, provider_name, region_id):
2828
pass
2929

30-
@get('cloud/providers/{provider_name}/regions/', paginate=True)
31-
def search_regions(self, provider_name, **kwargs):
32-
pass
33-
3430
@get('cloud/providers/{provider_name}/zones/', paginate=True)
35-
def list_zones(self):
31+
def list_zones(self, provider_name, **kwargs):
3632
pass
3733

3834
@get('cloud/providers/{provider_name}/zones/{zone_id}')
3935
def get_zone(self, provider_name, zone_id):
4036
pass
41-
42-
@get('cloud/providers/{provider_name}/zones/', paginate=True)
43-
def search_zones(self, provider_name, **kwargs):
44-
pass

stackdio/client/stack.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def create_stack(self, stack_data):
3333
return stack_data
3434

3535
@get('stacks/', paginate=True)
36-
def list_stacks(self):
36+
def list_stacks(self, **kwargs):
3737
"""Return a list of all stacks"""
3838
pass
3939

@@ -42,11 +42,6 @@ def get_stack(self, stack_id):
4242
"""Get stack info"""
4343
pass
4444

45-
@get('stacks/', paginate=True)
46-
def search_stacks(self, **kwargs):
47-
"""Search for stacks that match the given criteria"""
48-
pass
49-
5045
@delete('stacks/{stack_id}/')
5146
def delete_stack(self, stack_id):
5247
"""Destructively delete a stack forever."""
@@ -100,6 +95,10 @@ def get_stack_history(self, stack_id):
10095
"""Get stack info"""
10196
pass
10297

98+
@get_stack_history.response
99+
def get_stack_history(self, resp):
100+
return list(reversed(resp))
101+
103102
@get('stacks/{stack_id}/hosts/', paginate=True)
104103
def get_stack_hosts(self, stack_id):
105104
"""Get a list of all stack hosts"""

0 commit comments

Comments
 (0)