hcs-cli 0.1.317__py3-none-any.whl → 0.1.318__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hcs_cli/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
- __version__ = "0.1.317"
1
+ __version__ = "0.1.318"
2
2
 
3
3
  from . import service
hcs_cli/cmds/api.py CHANGED
@@ -134,13 +134,14 @@ def api(
134
134
  f"Method {method} does not support request body. Use --data or --json or STDIN only with POST, PUT, or PATCH methods."
135
135
  )
136
136
 
137
- if path.startswith(profile.current().hcs.url):
138
- path = path[len(profile.current().hcs.url) :]
137
+ hcs_url = profile.current().hcs.url
138
+ if path.startswith(hcs_url):
139
+ path = path[len(hcs_url) :]
139
140
  if not path.startswith("/"):
140
141
  path = "/" + path
141
142
 
142
143
  if not path.startswith("/"):
143
- raise click.UsageError("Path must start with a '/'. Please provide a valid context path.")
144
+ raise click.UsageError("Path must start with a '/'. Please provide a valid context path. Provided path=" + path)
144
145
 
145
146
  service_path = path.split("/")[1]
146
147
  api_path = path[len(service_path) + 1 :]
@@ -155,6 +156,7 @@ def api(
155
156
  headers = None
156
157
 
157
158
  # print( f"{method} {api_path} text={raw_data} json={json_data}" )
159
+
158
160
  if method == "GET":
159
161
  if all_pages:
160
162
 
@@ -52,7 +52,7 @@ def start(service: str, skip: bool, force: bool, **kwargs):
52
52
 
53
53
  def pod_forwarding(pod_id):
54
54
  print("Start forwarding pod")
55
- pod_forwarding_command = f"kubectl port-forward {pod_id} 10762:10762"
55
+ pod_forwarding_command = f"kubectl port-forward {pod_id} 5005:5005"
56
56
  global _forwarding_process
57
57
  _forwarding_process = subprocess.Popen(shlex.split(pod_forwarding_command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
58
58
  print("Started forwarding pod. pid:", _forwarding_process.pid)
@@ -60,7 +60,7 @@ def pod_forwarding(pod_id):
60
60
 
61
61
  def run_with_debug(pod_id):
62
62
 
63
- run_app_command = f"kubectl exec -it {pod_id} -c app -- /bin/bash -c 'java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=10762 -jar app.jar'"
63
+ run_app_command = f"kubectl exec -it {pod_id} -c app -- /bin/bash -c 'java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar app.jar'"
64
64
 
65
65
  # Execute the command
66
66
  process = subprocess.Popen(shlex.split(run_app_command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -74,18 +74,42 @@ def createLicenseFeatures():
74
74
  log.trivial("Creating license features record for csp org id {}".format(org_id))
75
75
  client_id = os.environ.get("CSP_LICENSE_SVC_CLIENT_ID")
76
76
  client_secret = os.environ.get("CSP_LICENSE_SVC_CLIENT_SECRET")
77
- if not client_id:
78
- print("Using admin service credentials from current profile...") # which has service permission
79
- client_id = current_profile.override["admin"]["client-id"]
80
- client_secret = current_profile.override["admin"]["client-secret"]
81
- client = hcs_client(
82
- current_profile.hcs.url,
83
- {
84
- "url": current_profile.csp.url,
85
- "client_id": client_id,
86
- "client_secret": client_secret,
87
- },
88
- )
77
+ while True:
78
+ if client_id:
79
+ log.trivial("Using credentials from env CSP_LICENSE_SVC_CLIENT_ID")
80
+ break
81
+ override = current_profile.override
82
+ if override:
83
+ license_service_override = current_profile.override.get("license-features")
84
+ if license_service_override:
85
+ log.trivial("Using license-features service override from current profile...")
86
+ client_id = license_service_override["client-id"]
87
+ client_secret = license_service_override["client-secret"]
88
+ break
89
+
90
+ admin_override = current_profile.override.get("admin")
91
+ if admin_override:
92
+ log.trivial("Using admin service override from current profile...")
93
+ client_id = current_profile.override["admin"]["client-id"]
94
+ client_secret = current_profile.override["admin"]["client-secret"]
95
+ break
96
+
97
+ log.warn("No admin override found in current profile. Using default credentials.")
98
+ client_id = None
99
+ break
100
+
101
+ if client_id:
102
+ client = hcs_client(
103
+ current_profile.hcs.url,
104
+ {
105
+ "url": current_profile.csp.url,
106
+ "client_id": client_id,
107
+ "client_secret": client_secret,
108
+ },
109
+ )
110
+ else:
111
+ # default profile
112
+ client = hcs_client(url=current_profile.hcs.url, custom_auth=current_profile.csp)
89
113
  response_data = client.post("/license-features/v1/licenses", json=data)
90
114
  log.good(f"Successfully created license-features: {response_data}")
91
115
 
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from time import sleep, time
2
3
 
3
4
  import click
@@ -8,7 +9,6 @@ from InquirerPy import inquirer
8
9
  from InquirerPy.base import Choice
9
10
 
10
11
  import hcs_cli.cmds.dev.util.github_helper as github_helper
11
- from hcs_cli.cmds.dev.fs.init import _retrieve_config_from_nightly_repo
12
12
  from hcs_cli.cmds.dev.util.log import fail
13
13
  from hcs_cli.support.exec_util import run_cli
14
14
 
@@ -125,6 +125,40 @@ def delete(all: bool, org: str):
125
125
  click.echo("Reset complete.")
126
126
 
127
127
 
128
+ @onboard.command()
129
+ @cli.org_id
130
+ def init_org(org):
131
+ """[Global admin] Init HCS org (org, location, and license)."""
132
+ org_id = cli.get_org_id(org)
133
+ proceed = click.confirm("This only works with non-prod stack. Continue?")
134
+ if not proceed:
135
+ return "", 1
136
+ proceed = click.confirm("This operation requires that the current profile has global admin privileges. Continue?")
137
+ if not proceed:
138
+ return "", 1
139
+ proceed = click.confirm(f"Target org: {org_id}")
140
+ if not proceed:
141
+ return "", 1
142
+ _ensure_org_initialized(org_id, critical=True)
143
+
144
+
145
+ def _ensure_org_initialized(org_id, critical=False):
146
+ os.environ["ORG_ID"] = org_id
147
+ try:
148
+ from hcs_cli.cmds.dev.fs.init import _create_license_info, _create_org_details, _create_org_location_mapping
149
+
150
+ _create_org_details()
151
+ _create_org_location_mapping()
152
+ _create_license_info()
153
+ except Exception as e:
154
+ if critical:
155
+ click.secho(f"Error initializing org: {e}", fg="bright_red")
156
+ else:
157
+ click.secho(
158
+ f"Error initializing org: {e}. If you have already initialized the org, you can ignore this warning.", fg="bright_yellow"
159
+ )
160
+
161
+
128
162
  def _delete_express_onboarding_deployment(org_id: str):
129
163
  deployment = run_cli(f"hcs api /deployment-orchestrator/v1/deployments?org_id={org_id}", output_json=True)
130
164
  if not deployment:
@@ -20,40 +20,86 @@ import uuid
20
20
  import click
21
21
  import hcs_core.sglib.cli_options as cli
22
22
 
23
- from hcs_cli.service import auth, inventory, portal
23
+ from hcs_cli.service import admin, auth, inventory, lcm, portal
24
24
  from hcs_cli.support.param_util import parse_vm_path
25
25
 
26
26
 
27
27
  @click.command()
28
28
  @cli.org_id
29
- @click.option(
30
- "--file",
31
- "-f",
32
- type=click.File("rt"),
33
- default=sys.stdin,
34
- help="Specify the template file name. If not specified, STDIN will be used.",
35
- )
36
- @click.option("--vm", type=str, required=False)
37
- def assign(org: str, file, vm: str):
29
+ @click.argument("vm_path", type=str, required=False)
30
+ def assign(org: str, vm_path: str):
38
31
  """Assign user to VM"""
39
32
  org_id = cli.get_org_id(org)
33
+ template_id, vm_id = parse_vm_path(vm_path)
40
34
 
41
- with file:
42
- data = file.read()
43
-
44
- try:
45
- payload = json.loads(data)
46
- except Exception as e:
47
- msg = "Invalid payload: " + str(e)
48
- return msg, 1
49
-
50
- if vm:
51
- template, vm_id = parse_vm_path(vm)
52
- payload["templateIds"] = [template]
53
- payload["vmId"] = vm_id
35
+ template = admin.template.get(template_id, org_id)
36
+ if template:
37
+ edge_id = template["edgeDeploymentId"]
38
+ else:
39
+ # try with lcm
40
+ template = lcm.template.get(template_id, org_id)
41
+ edge_id = template["edgeGateway"]["id"]
42
+ if not template:
43
+ return "Template not found: " + template_id, 1
44
+ payload = {
45
+ "id": "dspec1",
46
+ "userId": "user1",
47
+ "clientId": "client-1",
48
+ "entitlementId": "entitlement-1",
49
+ "templateIds": [template_id],
50
+ "allocationPolicy": "ANY",
51
+ "sessionType": "DESKTOP",
52
+ "username": "user1",
53
+ "userPrincipalName": "aduser1@vmwhorizon.com",
54
+ "userSid": "S-1-5-21-2502306595",
55
+ "orgId": org_id,
56
+ "location": template["location"],
57
+ "vmId": vm_id,
58
+ "templateType": template["templateType"],
59
+ "resume": True,
60
+ "clientSessionId": "client-uuid-1",
61
+ }
62
+ # print(json.dumps(payload, indent=4))
63
+ inventory.assignV2(payload)
54
64
 
55
- payload["orgId"] = org_id
56
- return inventory.assign(payload)
65
+ # payload_manual_session = {
66
+ # "templateId": "string",
67
+ # "vmId": "string",
68
+ # "userId": "string",
69
+ # "agentSessionGuid": "string",
70
+ # "agentSessionId": "string",
71
+ # "agentStaticSessionGuid": "string",
72
+ # "sessionType": "DESKTOP",
73
+ # "templateType": "FLOATING",
74
+ # "clientId": "string",
75
+ # "sessionStatus": "string",
76
+ # "lastAssignedTime": "2025-12-16T20:56:08.988Z",
77
+ # "lastLoginTime": "2025-12-16T20:56:08.988Z",
78
+ # "lastStatusUpdateTime": "2025-12-16T20:56:08.988Z",
79
+ # "username": "string",
80
+ # "userPrincipalName": "string",
81
+ # "userSid": "string",
82
+ # "entitlementId": "string",
83
+ # "orgId": "string",
84
+ # "location": "string",
85
+ # "clientSessionId": "UUID string",
86
+ # "agentErrorCode": "AGENT_ERR_FAILURE",
87
+ # "staticCloudSessionId": "UUID string",
88
+ # "hibernated": true,
89
+ # "id": 0,
90
+ # "dspecId": "string"
91
+ # }
92
+ payload_update = {
93
+ "id": "dspec1",
94
+ "agentSessionGuid": "agent-session-guid-1",
95
+ "agentSessionId": "agent-session-1",
96
+ "agentStaticSessionGuid": "agent-static-session-guid-1",
97
+ "sessionStatus": "string",
98
+ "vmId": vm_id,
99
+ "edgeId": edge_id,
100
+ "agentErrorCode": "",
101
+ }
102
+ return inventory.update_session(org_id=org_id, template_id=template_id, payload=payload_update)
57
103
 
58
104
 
59
105
  @click.command()
@@ -19,29 +19,46 @@ import sys
19
19
  import click
20
20
  import hcs_core.sglib.cli_options as cli
21
21
 
22
- from hcs_cli.service import inventory
22
+ from hcs_cli.service import admin, inventory, lcm
23
+ from hcs_cli.support.param_util import parse_vm_path
23
24
 
24
25
 
25
26
  @click.command()
26
27
  @cli.org_id
27
- @click.option(
28
- "--file",
29
- "-f",
30
- type=click.File("rt"),
31
- default=sys.stdin,
32
- help="Specify the template file name. If not specified, STDIN will be used.",
33
- )
34
- def deassign(org: str, file):
28
+ @click.argument("vm_path", type=str, required=False)
29
+ def deassign(org: str, vm_path: str):
35
30
  """Assign user to VM"""
36
31
  org_id = cli.get_org_id(org)
37
- with file:
38
- data = file.read()
32
+ template_id, vm_id = parse_vm_path(vm_path)
33
+ sessions = inventory.sessions(template_id, vm_id, cli.get_org_id(org))
39
34
 
40
- try:
41
- payload = json.loads(data)
42
- except Exception as e:
43
- msg = "Invalid payload: " + str(e)
44
- return msg, 1
35
+ template = admin.template.get(template_id, cli.get_org_id(org))
36
+ if template:
37
+ edge_deployment_id = template["edgeDeploymentId"]
38
+ else:
39
+ # try with lcm
40
+ template = lcm.template.get(template_id, cli.get_org_id(org))
41
+ if not template:
42
+ return "Template not found: " + template_id, 1
43
+ edge_deployment_id = template["edgeGateway"]["id"]
45
44
 
46
- payload["orgId"] = org_id
47
- return inventory.deassign(payload)
45
+ all_ret = []
46
+ for session in sessions:
47
+ payload = {
48
+ "vmHubName": template["hdc"]["vmHub"]["name"],
49
+ "edgeDeploymentId": edge_deployment_id,
50
+ "vmId": vm_id,
51
+ "entitlementId": session.get("entitlementId"),
52
+ "agentSessionGuid": session.get("agentSessionGuid"),
53
+ "agentSessionId": session.get("agentSessionId"),
54
+ "agentStaticSessionGuid": session.get("agentStaticSessionGuid"),
55
+ "id": session.get("dspecId"),
56
+ "userId": session.get("userId"),
57
+ "type": session.get("sessionType"),
58
+ }
59
+ ret = inventory.deassign(template_id=template_id, org_id=org_id, payload=payload)
60
+ all_ret.append(ret)
61
+
62
+ if len(all_ret) == 1:
63
+ return all_ret[0]
64
+ return all_ret
@@ -16,17 +16,95 @@ limitations under the License.
16
16
  import click
17
17
  import hcs_core.sglib.cli_options as cli
18
18
 
19
- from hcs_cli.service import inventory
19
+ from hcs_cli.service import admin, inventory, lcm
20
20
  from hcs_cli.support.param_util import parse_vm_path
21
21
 
22
22
 
23
23
  @click.command()
24
24
  @cli.org_id
25
- @click.argument("vm_path", type=str, required=True)
25
+ @click.argument("vm_path", type=str, required=False)
26
26
  def logoff(org: str, vm_path: str):
27
- """Log off an user"""
28
- template, vm = parse_vm_path(vm_path)
29
- ret = inventory.logoff(template, vm, cli.get_org_id(org))
30
- if ret:
31
- return ret
32
- return ret, 1
27
+ """Logoff all sessions on the vm.
28
+
29
+ Example: hcs inventory logoff template_id/vm_id
30
+ """
31
+
32
+ org_id = cli.get_org_id(org)
33
+ template_id, vm_id = parse_vm_path(vm_path)
34
+ sessions = inventory.sessions(template_id, vm_id, cli.get_org_id(org))
35
+ if not sessions:
36
+ return
37
+ # [
38
+ # {
39
+ # "templateId": null,
40
+ # "vmId": "expool000",
41
+ # "userId": "c12b884b-c813-4f73-81f5-df2052de9bc6",
42
+ # "agentSessionGuid": null,
43
+ # "agentSessionId": null,
44
+ # "agentStaticSessionGuid": null,
45
+ # "sessionType": "DESKTOP",
46
+ # "templateType": "FLOATING",
47
+ # "clientId": null,
48
+ # "sessionStatus": "ASSIGNED",
49
+ # "lastAssignedTime": "2025-12-16T18:55:45.078+00:00",
50
+ # "lastLoginTime": null,
51
+ # "lastStatusUpdateTime": "2025-12-16T18:55:45.078+00:00",
52
+ # "username": "u1ad1",
53
+ # "userPrincipalName": "u1ad1@horizonv2dev2.local",
54
+ # "userSid": "S-1-5-21-1840667356-2516272024-4034330832-1104",
55
+ # "releaseSessionOnDeassign": false,
56
+ # "entitlementId": "6941a2bfe79a1b9cef167ad2",
57
+ # "orgId": "7c4f9042-6119-45b6-93f5-24f1a80e2c62",
58
+ # "location": null,
59
+ # "clientSessionId": null,
60
+ # "agentErrorCode": "",
61
+ # "staticCloudSessionId": "dc907d57-85d8-478e-9d0c-028c1acd87f2",
62
+ # "hibernated": null,
63
+ # "id": null,
64
+ # "dspecId": "5722ff4a-7e75-4248-89e9-741d8a7ae91c"
65
+ # }
66
+ # ]
67
+
68
+ template = admin.template.get(template_id, cli.get_org_id(org))
69
+ if template:
70
+ edge_deployment_id = template["edgeDeploymentId"]
71
+ else:
72
+ # try with lcm
73
+ template = lcm.template.get(template_id, cli.get_org_id(org))
74
+ if not template:
75
+ return "Template not found: " + template_id, 1
76
+ edge_deployment_id = template["edgeGateway"]["id"]
77
+
78
+ all_ret = []
79
+ for session in sessions:
80
+ logoff_payload_v1 = {
81
+ "edgeDeploymentId": edge_deployment_id,
82
+ "vmId": vm_id,
83
+ "userId": session.get("userId"),
84
+ "entitlementId": session.get("entitlementId"),
85
+ "vmHubName": template["hdc"]["vmHub"]["name"],
86
+ "sessionType": session.get("sessionType"),
87
+ }
88
+ ret1 = inventory.logoff(template_id=template_id, org_id=org_id, payload=logoff_payload_v1)
89
+ # print("PAYLOADv1: ", logoff_payload_v1)
90
+ # print("RETv1: ", ret1)
91
+ all_ret.append(ret1)
92
+
93
+ logoff_payload_v2 = [
94
+ {
95
+ "agentSessionGuid": session.get("agentSessionGuid"),
96
+ "userId": session.get("userId"),
97
+ "sessionType": session.get("sessionType"),
98
+ "vmHubName": template["hdc"]["vmHub"]["name"],
99
+ "edgeDeploymentId": edge_deployment_id,
100
+ "vmId": vm_id,
101
+ "dspecId": session.get("dspecId"),
102
+ "dtemplateId": template_id,
103
+ }
104
+ ]
105
+ ret2 = inventory.logoffV2(org_id=org_id, payload=logoff_payload_v2)
106
+ # print("PAYLOADv2: ", logoff_payload_v2)
107
+ # print("RETv2: ", ret2)
108
+ all_ret.append(ret2)
109
+
110
+ return all_ret
@@ -16,7 +16,7 @@ limitations under the License.
16
16
  import click
17
17
  import hcs_core.sglib.cli_options as cli
18
18
 
19
- from hcs_cli.service import inventory
19
+ from hcs_cli.service import admin, inventory
20
20
  from hcs_cli.support.param_util import parse_vm_path
21
21
 
22
22
 
@@ -27,7 +27,7 @@ def session():
27
27
 
28
28
  @session.command()
29
29
  @cli.org_id
30
- @click.argument("vm_path", type=str, required=True)
30
+ @click.argument("vm_path", type=str, required=False)
31
31
  def list(org: str, vm_path: str):
32
32
  """List sessions"""
33
33
  template, vm = parse_vm_path(vm_path)
@@ -60,8 +60,8 @@ def _print_error(text: str):
60
60
 
61
61
  def _print_human_readable_log(d: TaskModel):
62
62
  ret = d.log
63
- time_started = ret.time_started
64
- time_completed = ret.time_completed
63
+ time_started = ret.timeStarted
64
+ time_completed = ret.timeCompleted
65
65
 
66
66
  if time_completed:
67
67
  delta = timedelta(milliseconds=time_completed - time_started)
@@ -0,0 +1,65 @@
1
+ """
2
+ Copyright 2023-2023 VMware Inc.
3
+ SPDX-License-Identifier: Apache-2.0
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ """
15
+
16
+ import click
17
+ import hcs_core.sglib.cli_options as cli
18
+ import hcs_core.util.duration as duration
19
+ from hcs_core.ctxp import recent
20
+
21
+ import hcs_cli.service.admin as admin
22
+
23
+
24
+ @click.command(hidden=True)
25
+ @click.option(
26
+ "--number",
27
+ "-n",
28
+ type=int,
29
+ required=False,
30
+ default=1,
31
+ help="Number of VMs to expand. Use negative number to shrink.",
32
+ )
33
+ @click.argument("template_id", type=str, required=False)
34
+ @cli.org_id
35
+ @cli.wait
36
+ def expand(number: int, template_id: str, org: str, wait: str, **kwargs):
37
+ """Update an existing template"""
38
+
39
+ org_id = cli.get_org_id(org)
40
+
41
+ template_id = recent.require("template", template_id)
42
+ template = admin.template.get(template_id, org_id)
43
+
44
+ if not template:
45
+ return "Template not found: " + template_id
46
+
47
+ spare_policy = template.get("sparePolicy", {})
48
+ patch = {
49
+ "sparePolicy": {
50
+ "min": spare_policy.get("min", 0) + number,
51
+ "max": spare_policy.get("max", 0) + number,
52
+ "limit": spare_policy.get("limit", 0) + number,
53
+ }
54
+ }
55
+ if patch["sparePolicy"]["min"] < 0:
56
+ patch["sparePolicy"]["min"] = 0
57
+ if patch["sparePolicy"]["max"] < 0:
58
+ patch["sparePolicy"]["max"] = 0
59
+ if patch["sparePolicy"]["limit"] < 0:
60
+ patch["sparePolicy"]["limit"] = 0
61
+
62
+ ret = admin.template.update(template_id, org_id, patch)
63
+ if wait != "0":
64
+ ret = admin.template.wait_for_ready(template_id, org_id, duration.to_seconds(wait))
65
+ return ret
@@ -26,6 +26,11 @@ def deploy(data: dict, state: dict, save_state) -> dict:
26
26
  else:
27
27
  deployment = state
28
28
  id = deployment["id"]
29
+
30
+ _wait = data.get("_wait", True)
31
+ if not _wait:
32
+ return deployment
33
+
29
34
  try:
30
35
  deployment = admin.uag.wait_for_ready(id, org_id, "10m")
31
36
  except Exception as e:
@@ -1,2 +1,2 @@
1
- from .session import assign, deassign, logoff, sessions
1
+ from .session import assign, assignV2, create_manual_session, deassign, logoff, logoffV2, sessions, update_session
2
2
  from .vm import count, get, list, raw_list, update
@@ -28,22 +28,38 @@ def sessions(template_id: str, vm_id: str, org_id: str, **kwargs):
28
28
 
29
29
 
30
30
  def assign(payload):
31
- # https://horizonv2-sg.devframe.cp.horizon.vmware.com/inventory/swagger-ui/#/Inventory/assign
31
+ # https://horizonv2-sg.devframe.cp.horizon.omnissa.com/inventory/swagger-ui/#/Inventory/assign
32
32
  url = "/v1/assign"
33
33
  return _client.post(url, payload)
34
34
 
35
35
 
36
36
  def assignV2(payload):
37
- # https://horizonv2-sg.devframe.cp.horizon.vmware.com/inventory/swagger-ui/#/Inventory/assign
37
+ # https://horizonv2-sg.devframe.cp.horizon.omnissa.com/inventory/swagger-ui/#/Inventory/assign
38
38
  url = "/v2/assign"
39
39
  return _client.post(url, payload)
40
40
 
41
41
 
42
- def deassign(payload):
43
- # https://horizonv2-sg.devframe.cp.horizon.vmware.com/inventory/swagger-ui/#/Inventory/deassign
44
- url = "/v1/deassign"
42
+ def deassign(template_id: str, org_id: str, payload):
43
+ # https://horizonv2-sg.devframe.cp.horizon.omnissa.com/inventory/swagger-ui/#/Inventory/deassign
44
+ url = f"/v1/{template_id}/deassign?org_id={org_id}"
45
45
  return _client.post(url, payload)
46
46
 
47
47
 
48
- def logoff(template_id: str, vm_id: str, org_id: str):
49
- return "TODO: hcs_cli.service.inventory.logoff"
48
+ def logoff(template_id: str, org_id: str, payload: dict):
49
+ url = f"/v1/{template_id}/logoff?org_id={org_id}"
50
+ return _client.post(url, payload)
51
+
52
+
53
+ def logoffV2(org_id: str, payload: dict):
54
+ url = f"/v2/logoff?org_id={org_id}"
55
+ return _client.post(url, payload)
56
+
57
+
58
+ def update_session(org_id: str, template_id: str, payload: dict):
59
+ url = f"/v1/{template_id}/sessionUpdate?org_id={org_id}"
60
+ return _client.post(url, payload)
61
+
62
+
63
+ def create_manual_session(org_id: str, template_id: str, edge_id: str, payload: dict):
64
+ url = f"/v1/{template_id}/session?org_id={org_id}&edge_id={edge_id}"
65
+ return _client.post(url, payload)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hcs-cli
3
- Version: 0.1.317
3
+ Version: 0.1.318
4
4
  Summary: Horizon Cloud Service CLI.
5
5
  Project-URL: Homepage, https://github.com/euc-eng/hcs-cli
6
6
  Project-URL: Bug Tracker, https://github.com/euc-eng/hcs-cli/issues
@@ -14,7 +14,7 @@ Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python :: 3
16
16
  Requires-Python: >=3.9
17
- Requires-Dist: hcs-core>=0.1.317
17
+ Requires-Dist: hcs-core>=0.1.318
18
18
  Requires-Dist: inquirerpy>=0.3.4
19
19
  Requires-Dist: matplotlib>=3.8.0
20
20
  Requires-Dist: paho-mqtt>=2.1.0
@@ -1,8 +1,8 @@
1
- hcs_cli/__init__.py,sha256=kalA51nvL9r2WycXeW3H-kyqLPN91e0eb_ELOm5f-FM,47
1
+ hcs_cli/__init__.py,sha256=wQI-00IFMJng7FbIekUpBOJINM40mCfEr4HE5B_Uv5w,47
2
2
  hcs_cli/__main__.py,sha256=lwPXLjh1OpOs4doVLJJ6_3XHtC-VqDOXiw45hvAQorM,684
3
3
  hcs_cli/main.py,sha256=87MoOqaYQ1V7m9LJbek3GR_RojErr4j6watZD8oenk0,3539
4
4
  hcs_cli/cmds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- hcs_cli/cmds/api.py,sha256=fKN14wsHuhrcq87NtdN9EzMXkT8P_GyRAWtRgs39VQ8,6988
5
+ hcs_cli/cmds/api.py,sha256=IIz-vORyL5EzDOSCOSgdP_6MIjGG6KvinnCkyg8JUpg,7015
6
6
  hcs_cli/cmds/inspect.py,sha256=QBhBOkf2mHlGhgAhY9FXCfvViL2p4D3BudoKjyADdfE,659
7
7
  hcs_cli/cmds/login.py,sha256=dj42jDrKktt4bUqSD0Xj6Jo9ZSI7M9v9R280YavWpuc,11165
8
8
  hcs_cli/cmds/logout.py,sha256=BxU-K1cIkdBpAAp6SGuwEqECL6g20l9CqEcSX-3pZag,744
@@ -65,11 +65,11 @@ hcs_cli/cmds/daas/tenant/plan.py,sha256=mQkHZXNkv2QC4Tf-tLE5EcSkGDA5zGS0Yr67q2Vx
65
65
  hcs_cli/cmds/debug/__init__.py,sha256=ShRQnpuVORL1Z9ogbrsAnw8MvK8NwYfI9uJ8ORYvjQ4,646
66
66
  hcs_cli/cmds/debug/prepare.py,sha256=HstQLZbB2k76x3I7klKQx-9hLcSzNl8gydzZTi7lUYc,1560
67
67
  hcs_cli/cmds/debug/reset.py,sha256=l0KonlLTAcLQBrs7tcQalGHa2a5w5YFGvGH4u5g2QNY,2590
68
- hcs_cli/cmds/debug/start.py,sha256=soPvuc3ZqKDboNjRPGQadhIPyKwq7LJzI90VpUZCVOg,4174
68
+ hcs_cli/cmds/debug/start.py,sha256=0-7G8Qz3A08lk0UvVjgs2jQ2-3h9fQLFap3OdWgSpHM,4171
69
69
  hcs_cli/cmds/dev/__init__.py,sha256=bq_aR1IrtOSVAqzB5G5R3scLBUKmaYw84BEW9MwHk30,645
70
70
  hcs_cli/cmds/dev/emqx.py,sha256=FORmgG4BhpJVj3i1g6Ujkx6pG0hZNy-jpljBg7-3lG8,4998
71
71
  hcs_cli/cmds/dev/mqtt.py,sha256=LQ6s7AcSgW8E9vkZgFqxXbz4wodRT4Gee0pgZKUZ8fo,6640
72
- hcs_cli/cmds/dev/onboard.py,sha256=acPS2gzESrZvnGfQ0DAQF3wMUgbMSqousdCHMIbsMOU,14445
72
+ hcs_cli/cmds/dev/onboard.py,sha256=7guWRWbJIDOBiDMdWghAilyERmxQY3HCdt6atnauYXA,15588
73
73
  hcs_cli/cmds/dev/test.py,sha256=VP-I-H3MdS1j8FaTiZclQt4HCLUPmiXg__4cn1smgM8,976
74
74
  hcs_cli/cmds/dev/fs/__init__.py,sha256=8hlQwsU-qFh1L2TmyQ9gokur7vxjCl1fwChEbkK8cgg,633
75
75
  hcs_cli/cmds/dev/fs/auth.py,sha256=GsjT-ATwD_G_BUma0PK114KME3RnF_lDKHB0HrjGQKs,909
@@ -81,7 +81,7 @@ hcs_cli/cmds/dev/fs/helper/__init__.py,sha256=AC-hl0F-5R4V2uejk5FzFDlvT7uKGfjQyW
81
81
  hcs_cli/cmds/dev/fs/helper/credential_helper.py,sha256=ygSFitrStjiRNW00ike8orqxTzO5sPPZq08PCmotdKk,3186
82
82
  hcs_cli/cmds/dev/fs/helper/jenkins_util.py,sha256=YFms6tEQBVZc8Svh0OFOIXXxrzNPo8Gu44FqBKby1Ow,3208
83
83
  hcs_cli/cmds/dev/fs/helper/k8s_util.py,sha256=MAxlk-XEPN1RA6D0Lm8X-idLBsffWTq_JNOT9Nyf01o,2876
84
- hcs_cli/cmds/dev/fs/helper/license_info.py,sha256=SjD1cVUFEKL2_2jmAN183FDUbVYkUV3YA8YqXzz_OSg,3964
84
+ hcs_cli/cmds/dev/fs/helper/license_info.py,sha256=BJR6hCZFf_1A1DsAill4ZpOgRRopo899RQ9QIZPt4Yk,4953
85
85
  hcs_cli/cmds/dev/fs/helper/required_fields.py,sha256=hdqyONlveka3mq2HxfTOkNqIaSnO8eVj9j98LSQy2Fw,383
86
86
  hcs_cli/cmds/dev/fs/helper/step_util.py,sha256=CbJps94SyiqaFRI1UPRkwcpezwc1zn2pAOjcgfLGpsA,1001
87
87
  hcs_cli/cmds/dev/fs/helper/util.py,sha256=4qc6MT45Os3dZopNhngidIKj7sa5nBYt9lKl2EVLH7U,881
@@ -147,13 +147,13 @@ hcs_cli/cmds/ims/version/delete.py,sha256=3SUG2JrB53duC9HjiE0mS33DKE_UCN9qmQABo_
147
147
  hcs_cli/cmds/ims/version/get.py,sha256=cDJ5VQvSsVT-MA-E_RS4KbqdysV__IOMG_cbU7NvaRI,1285
148
148
  hcs_cli/cmds/ims/version/list.py,sha256=UV2fZlEoH3mPq74HmgWlaDGVriJo30Grz0FW1JKeo-I,1140
149
149
  hcs_cli/cmds/inventory/__init__.py,sha256=MHbL9kVMQm--omd6_50d48o9Ff8vlQ9JWXEtW08mK60,637
150
- hcs_cli/cmds/inventory/assign.py,sha256=GtaJY172d6ko8xEDTBx6FS4jSa9hUmGi9x5EdLs9hro,3009
150
+ hcs_cli/cmds/inventory/assign.py,sha256=aNXkI1F6Cs1flSlXxgnTedfQ2w05kjav0Pgig1X4cOw,4946
151
151
  hcs_cli/cmds/inventory/count.py,sha256=AR_9HyO4hMLJp1FhrX4RTbpqF2aLWjiyKASdBi5kfjE,401
152
- hcs_cli/cmds/inventory/deassign.py,sha256=_7b9oUwoLr1zmHxWCkcobSME0smnSHSXl-TIXIJfIU0,1261
152
+ hcs_cli/cmds/inventory/deassign.py,sha256=87E5YcxPELfuacFhXTXiY5cy3lSQB7NHytKm-4-JtlY,2280
153
153
  hcs_cli/cmds/inventory/get.py,sha256=EpGoHzNA9taubw5ohkoj6bsQQVz2nBn8z05i5vKzH58,1072
154
154
  hcs_cli/cmds/inventory/list.py,sha256=Cmm7uhNSsBJVgXqEFuPlTrKMe6yCZU1GLWU4BnFtgZo,3602
155
- hcs_cli/cmds/inventory/logoff.py,sha256=-livX_q0fOJUc4bpRMr1mPIwcUiv15z2mIsFYCfR0iE,1044
156
- hcs_cli/cmds/inventory/session.py,sha256=ylTSoQ83WfF5Yb_13sttYAIueApfNxrFjfcK6g02X00,1085
155
+ hcs_cli/cmds/inventory/logoff.py,sha256=EUE_RcEnnFhgtBePXcP-CerRHgFfzTqItrCddUVyJTc,4137
156
+ hcs_cli/cmds/inventory/session.py,sha256=jFsQYM0rEpO1qKywxpmKIOVPbvf3JNpdf3QjcvYy9-Q,1093
157
157
  hcs_cli/cmds/inventory/update.py,sha256=mj442Cunf5OBow57muxzrszRPYdAwxvjnLHwCErdMSc,1612
158
158
  hcs_cli/cmds/iss/__init__.py,sha256=0oK2pAPG4Da-SmruPIOz1_F5hcG1v4TnEDH1KVjlx3Y,644
159
159
  hcs_cli/cmds/iss/mqtt.py,sha256=CM3f_NMaazfJgCioBmJGln44jSp73H1dJnvsNnzPAEY,4241
@@ -230,7 +230,7 @@ hcs_cli/cmds/provider/use.py,sha256=xBxuniPT0gi726sweNZ7-7lterUgD00BsabiUvBH-LU,
230
230
  hcs_cli/cmds/provider/vsphere_dcs.py,sha256=iY1y-JtFuE5VAD1ieeJHv0R2MzDYQiT-XvYKEez9sDY,1039
231
231
  hcs_cli/cmds/scm/__init__.py,sha256=qOaaE1aCoIxeA7nRxhI0ZasMEE-KZ9PAfEkTSWdWcHw,653
232
232
  hcs_cli/cmds/scm/health.py,sha256=c_0wOh3S4sHBLpAbcjvZGOToRjaEQHlyBD44Ry7pmsI,1277
233
- hcs_cli/cmds/scm/operator.py,sha256=nGG2WYNlBouSMfWF6Bv1x4ZunqaUSsOIM4Yb4D5lWs0,3893
233
+ hcs_cli/cmds/scm/operator.py,sha256=9RQPgx0zHUIJLrJnNEu0rUw2VTD73lY-91iYVJ77Pck,3891
234
234
  hcs_cli/cmds/scm/plan.py,sha256=DJvxj-UaeAq-FxXbggAfmopJhN7j-18frBfIB2gSFdY,12131
235
235
  hcs_cli/cmds/scm/template.py,sha256=X33WJPrVCY0P_SRL4BFjNDH8Ax863Fn_uRQdG-1wsTA,1546
236
236
  hcs_cli/cmds/site/__init__.py,sha256=f5ZuflhKsBw-8TAJ8xWzlw5lnIU8Imba70GIYSzgz-Q,624
@@ -261,6 +261,7 @@ hcs_cli/cmds/synt/report/list.py,sha256=vk0A-rNPWakKLfuzp3TzTLn47dcMDjAKuujRdaq5
261
261
  hcs_cli/cmds/template/__init__.py,sha256=0MLiuwktWNE_kV36BGSXEv8jAUZQCLHWpfmRvu-IHCU,628
262
262
  hcs_cli/cmds/template/create.py,sha256=LBK0ijSeAS2PECR81FGRAlh9Zu6kxQQw6173Kxqkd8E,1909
263
263
  hcs_cli/cmds/template/delete.py,sha256=GSxtTKqe0DSE6FNt20FMGwFlTKNvygMDTTnxHPwBiRM,1330
264
+ hcs_cli/cmds/template/expand.py,sha256=_Pv9ewmk1iX9h-YzQFn1wIvqWl2SAhVfcOzLF9LCN_U,2082
264
265
  hcs_cli/cmds/template/fix.py,sha256=aMRamRlJHS1ARseU3MKVRft0ilnbN-vtjO8Ia2S8TA4,2813
265
266
  hcs_cli/cmds/template/get.py,sha256=M-GSJfsV9RWyFomQdwtkB7_Ga52G8TXlcNseo4crolQ,1017
266
267
  hcs_cli/cmds/template/list.py,sha256=106v3Ng-n7AlvSvVa7GYxQQmY7R1qBfP45XnjDTa8Ko,3526
@@ -383,7 +384,7 @@ hcs_cli/provider/hcs/pool_group.py,sha256=vb4W1DVcFngmXGM6PBEaBXz8SX9qamr6Amq5-C
383
384
  hcs_cli/provider/hcs/pool_template.py,sha256=poWWx77YzdzwpEAaEXCgaNnOwMT8M3z1UgiZXG0nSkg,2137
384
385
  hcs_cli/provider/hcs/provider.py,sha256=jNHUTEh41F3wrTdtPzyANjRFePEsMar8ivob-mu0CQc,2205
385
386
  hcs_cli/provider/hcs/site.py,sha256=kXsu8jhX77Fo_HSNd85V4sMd-uqD9QUm_yVcK0L6pyE,1415
386
- hcs_cli/provider/hcs/uag.py,sha256=bhl8azaKT2DfJ1kxSQdAVqPDC-QWcS9fZLXYLqaq0SY,1959
387
+ hcs_cli/provider/hcs/uag.py,sha256=4sPdo5MW2CaaDsdkqwzCx51ZMdpcoS6aKhRELKgpq3o,2041
387
388
  hcs_cli/provider/hcs/runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
388
389
  hcs_cli/provider/hcs/runtime/password.py,sha256=_MmoKPUKXUJFjyDv6gSwKOX67XCSZ1DABwSE2HPEEfA,944
389
390
  hcs_cli/provider/hcs/runtime/wait_for.py,sha256=uWPQnG3Lb0yEt5DN7TFgQpmxasBLclA15PYFMV5bfds,2320
@@ -436,8 +437,8 @@ hcs_cli/service/ims/helper.py,sha256=0LgnJAE8W3_yGG3qG1Y6DMs7VUHHhKcrjRR2Ap8cNN8
436
437
  hcs_cli/service/ims/image_copies.py,sha256=zBZbFZS0jr9Ew9KanLc10qwHnV8iy0UdU9aFYum3Jw0,968
437
438
  hcs_cli/service/ims/images.py,sha256=FIuasv4fj4EZFVF7_BFfWW7JutZO8cr6X1h5LCb0qs4,2059
438
439
  hcs_cli/service/ims/version.py,sha256=xcsb5-YvGY3duZk0wHdVPmuJjyVf01dg26VGgBQaQxY,3330
439
- hcs_cli/service/inventory/__init__.py,sha256=BfwMFHbQPhO44L2Cf_8FjWW39pWPxH0cNkWjMQAgZwA,107
440
- hcs_cli/service/inventory/session.py,sha256=3utZ9aaD5HDAdyc2LDgJWshQ8VKykNmAz5KMun3F1Kk,1643
440
+ hcs_cli/service/inventory/__init__.py,sha256=vncedPyru5baoOZkhe0OuSOetvg-3aUX0dikC3_oiws,166
441
+ hcs_cli/service/inventory/session.py,sha256=VB9oCC297UmmymJ1cnbtdZoLklyi0GtjuKNnPAb5zEQ,2240
441
442
  hcs_cli/service/inventory/vm.py,sha256=JNVoZA1LYQS6Rm9JdAC1zu-gSkqpObvfJbUEDA7uvUo,2478
442
443
  hcs_cli/service/iss/__init__.py,sha256=LBifjQWYf4lqZWWdKk7wfB5F4HrqD4qpu9q-iLxVtK0,631
443
444
  hcs_cli/service/iss/mqtt.py,sha256=MS7KalunXez2sRozlH47eUPuXoKqU0Ib2QOWpcLb_g4,2142
@@ -489,7 +490,7 @@ hcs_cli/support/vm_table.py,sha256=aNyFtrQb2Cy4JBZx3sPt3_GpOHD7R6x4nITlwc9dZ4Q,2
489
490
  hcs_cli/support/scm/html_util.py,sha256=clgMpM90HxRRs3D9ORYYNB57AYh7y_-UzJrB4KX3dsY,458
490
491
  hcs_cli/support/scm/plan-editor.html.template,sha256=qXhHYjBsG8uaVlMkc0gnCePoSV3w5NyTkaLhXV9jlC0,26874
491
492
  hcs_cli/support/scm/plan_editor.py,sha256=pZtm9X_R-vs2JxJ_NX7-wTAoY-nhI-gFqhcyVDdEZVM,3108
492
- hcs_cli-0.1.317.dist-info/METADATA,sha256=HMB8zm8jPlN3k2sXbJDFcC98-xfhppGUM5hdm4N2eqs,3568
493
- hcs_cli-0.1.317.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
494
- hcs_cli-0.1.317.dist-info/entry_points.txt,sha256=5uH-af1WUETSBSer2bu4YMGQNY5RriJHsjepb8ACiX8,42
495
- hcs_cli-0.1.317.dist-info/RECORD,,
493
+ hcs_cli-0.1.318.dist-info/METADATA,sha256=bLWM0leSM4NgJJcTz5l8TBhaHnk-u0s79Kq5MZ2-8zY,3568
494
+ hcs_cli-0.1.318.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
495
+ hcs_cli-0.1.318.dist-info/entry_points.txt,sha256=5uH-af1WUETSBSer2bu4YMGQNY5RriJHsjepb8ACiX8,42
496
+ hcs_cli-0.1.318.dist-info/RECORD,,