Add profile-type to oka-add command 51/14751/3
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 20 Nov 2024 08:41:33 +0000 (09:41 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 25 Nov 2024 09:54:13 +0000 (10:54 +0100)
Change-Id: I64724449667a9b73f9d8c8f59630576411664b32
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/cli_commands/oka.py

index b6d4eb5..ff7ad83 100755 (executable)
@@ -26,9 +26,22 @@ logger = logging.getLogger("osmclient")
 @click.command(name="oka-add", short_help="adds an OSM Kubernetes Application (OKA)")
 @click.argument("name")
 @click.argument("path")
+@click.option(
+    "--profile-type",
+    type=click.Choice(
+        [
+            "infra-controller-profile",
+            "infra-config-profile",
+            "app-profile",
+            "resource-profile",
+        ]
+    ),
+    default="app-profile",
+    help="type of profile",
+)
 @click.option("--description", default="", help="human readable description")
 @click.pass_context
-def oka_add(ctx, name, path, description):
+def oka_add(ctx, name, path, profile_type, description):
     """adds an OKA to OSM
 
     \b
@@ -36,8 +49,15 @@ def oka_add(ctx, name, path, description):
     PATH: path to a folder with the OKA or to a tar.gz file with the OKA
     """
     logger.debug("")
+    profile_type_mapping = {
+        "infra-controller-profile": "infra_controller_profiles",
+        "infra-config-profile": "infra_config_profiles",
+        "app-profile": "app_profiles",
+        "resource-profile": "resource_profiles",
+    }
     oka = {}
     oka["name"] = name
+    oka["profile_type"] = profile_type_mapping[profile_type]
     if description:
         oka["description"] = description
     ctx.obj.oka.create(name, content_dict=oka, filename=path)