Skip to content

Commit c1ee8a4

Browse files
authored
Manager for cco ckan env and logic for it (#147)
* Manager for `cco ckan env` and logic for it
1 parent 588b363 commit c1ee8a4

File tree

3 files changed

+161
-360
lines changed

3 files changed

+161
-360
lines changed

ckan_cloud_operator/providers/ckan/env/cli.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import click
2-
import yaml
3-
import json
42
import traceback
53

64
from ckan_cloud_operator import logs
@@ -26,6 +24,7 @@ def list_env():
2624
> DEV
2725
> PRD
2826
'''
27+
manager.list_environments()
2928

3029
@env.command()
3130
@click.argument('ENVIRONMENT')
@@ -35,7 +34,7 @@ def list_env():
3534
@click.option('--subscription', help='Azure subscription id [Azure only]')
3635
@click.option('--region', help='GCP region id Eg: europe-west1 [GCP only]')
3736
@click.option('--project', help='GCP project name [GCP only]')
38-
def add(environment, cloud_provider, cluster_name, resource_group, subscription, region, project):
37+
def add(environment, **kwargs):
3938
'''
4039
Adds an environment
4140
@@ -50,6 +49,7 @@ def add(environment, cloud_provider, cluster_name, resource_group, subscription,
5049
--project project-name
5150
> POC environment was succefully added
5251
'''
52+
manager.add_environment(environment, **kwargs)
5353

5454
@env.command()
5555
@click.argument('ENVIRONMENT')
@@ -59,7 +59,7 @@ def add(environment, cloud_provider, cluster_name, resource_group, subscription,
5959
@click.option('--subscription', help='Azure subscription id [Azure only]')
6060
@click.option('--region', help='GCP region id Eg: europe-west1 [GCP only]')
6161
@click.option('--project', help='GCP project name [GCP only]')
62-
def update(environment, cloud_provider, cluster_name, resource_group, subscription, region, project):
62+
def update(environment, **kwargs):
6363
'''
6464
Update configurations for given environment
6565
@@ -74,6 +74,7 @@ def update(environment, cloud_provider, cluster_name, resource_group, subscripti
7474
--project project-name
7575
> POC environment was succefully updated
7676
'''
77+
manager.update_environment(environment, **kwargs)
7778

7879
@env.command()
7980
@click.argument('ENVIRONMENT')
@@ -87,6 +88,7 @@ def set(environment):
8788
cco ckan env set poc
8889
> You are working with POC environment now
8990
'''
91+
manager.set_environment(environment)
9092

9193
@env.command()
9294
@click.argument('ENVIRONMENT')
@@ -99,3 +101,4 @@ def rm(environment):
99101
cco ckan env rm poc
100102
> POC environment was succesfully removed
101103
'''
104+
manager.remove_environment(environment)

0 commit comments

Comments
 (0)