Skip to content

Commit

Permalink
Manager for cco ckan env and logic for it (#147)
Browse files Browse the repository at this point in the history
* Manager for `cco ckan env` and logic for it
  • Loading branch information
zelima authored Jul 2, 2021
1 parent 588b363 commit c1ee8a4
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 360 deletions.
11 changes: 7 additions & 4 deletions ckan_cloud_operator/providers/ckan/env/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import click
import yaml
import json
import traceback

from ckan_cloud_operator import logs
Expand All @@ -26,6 +24,7 @@ def list_env():
> DEV
> PRD
'''
manager.list_environments()

@env.command()
@click.argument('ENVIRONMENT')
Expand All @@ -35,7 +34,7 @@ def list_env():
@click.option('--subscription', help='Azure subscription id [Azure only]')
@click.option('--region', help='GCP region id Eg: europe-west1 [GCP only]')
@click.option('--project', help='GCP project name [GCP only]')
def add(environment, cloud_provider, cluster_name, resource_group, subscription, region, project):
def add(environment, **kwargs):
'''
Adds an environment
Expand All @@ -50,6 +49,7 @@ def add(environment, cloud_provider, cluster_name, resource_group, subscription,
--project project-name
> POC environment was succefully added
'''
manager.add_environment(environment, **kwargs)

@env.command()
@click.argument('ENVIRONMENT')
Expand All @@ -59,7 +59,7 @@ def add(environment, cloud_provider, cluster_name, resource_group, subscription,
@click.option('--subscription', help='Azure subscription id [Azure only]')
@click.option('--region', help='GCP region id Eg: europe-west1 [GCP only]')
@click.option('--project', help='GCP project name [GCP only]')
def update(environment, cloud_provider, cluster_name, resource_group, subscription, region, project):
def update(environment, **kwargs):
'''
Update configurations for given environment
Expand All @@ -74,6 +74,7 @@ def update(environment, cloud_provider, cluster_name, resource_group, subscripti
--project project-name
> POC environment was succefully updated
'''
manager.update_environment(environment, **kwargs)

@env.command()
@click.argument('ENVIRONMENT')
Expand All @@ -87,6 +88,7 @@ def set(environment):
cco ckan env set poc
> You are working with POC environment now
'''
manager.set_environment(environment)

@env.command()
@click.argument('ENVIRONMENT')
Expand All @@ -99,3 +101,4 @@ def rm(environment):
cco ckan env rm poc
> POC environment was succesfully removed
'''
manager.remove_environment(environment)
Loading

0 comments on commit c1ee8a4

Please sign in to comment.