psytricks 2.2.0a9__tar.gz → 2.2.0a18__tar.gz
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.
Potentially problematic release.
This version of psytricks might be problematic. Click here for more details.
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/PKG-INFO +8 -8
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/README.md +7 -7
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/pyproject.toml +1 -1
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__init__.py +1 -1
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/psytricks-lib.ps1 +1 -1
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/wrapper.py +281 -49
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/LICENSE +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/psytricks-wrapper.ps1 +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/restricks-server.example.xml +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/restricks-server.ps1 +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/sampledata/GetAccessUsers.json +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/sampledata/GetMachineStatus.json +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/sampledata/GetSessions.json +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/cli.py +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/decoder.py +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/literals.py +0 -0
- {psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/mappings.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: psytricks
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.0a18
|
|
4
4
|
Summary: PowerShell Python Citrix Tricks.
|
|
5
5
|
License-Expression: GPL-3.0-or-later
|
|
6
6
|
License-File: LICENSE
|
|
@@ -24,10 +24,10 @@ Description-Content-Type: text/markdown
|
|
|
24
24
|
|
|
25
25
|
# PSytricks
|
|
26
26
|
|
|
27
|
-

|
|
27
|
+
[](https://pypi.org/project/psytricks/)
|
|
28
28
|

|
|
29
|
-

|
|
30
|
-
](https://imcf.one/apidocs/psytricks)
|
|
30
|
+
[](https://github.com/astral-sh/ruff)
|
|
31
31
|
|
|
32
32
|
`P`ower`S`hell P`y`thon Ci`tri`x Tri`cks` - pun intended.
|
|
33
33
|
|
|
@@ -51,9 +51,9 @@ PSyTricks ships with two options for the PowerShell layer:
|
|
|
51
51
|
obviously this requires the code to be running as a service in an appropriate
|
|
52
52
|
permission context.
|
|
53
53
|
|
|
54
|
-
NOTE: this `RESTful` claim
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
NOTE: this `RESTful` claim isn't fully true. Or actually not at all, it would be
|
|
55
|
+
better called an `HTTP-JSON-RPC-API`. For now, we'll still be using the term
|
|
56
|
+
`REST` for it as the functionality of this package basically serves a very
|
|
57
57
|
similar purpose to what people think of when they are coming across this label.
|
|
58
58
|
Apologies, [Roy T. Fielding][www_rtf].
|
|
59
59
|
|
|
@@ -129,7 +129,7 @@ tried it and how it went!
|
|
|
129
129
|
|
|
130
130
|
To go with **WinSW** simply download the bundled version provided with each
|
|
131
131
|
[PSyTricks release][www_releases]. Just look for the `.zip` asset having `REST`
|
|
132
|
-
and `WinSW` in its name.
|
|
132
|
+
and `WinSW` in its name, matching your .NET version.
|
|
133
133
|
|
|
134
134
|
Unzip the downloaded file to the desired target location, e.g.
|
|
135
135
|
`%PROGRAMDATA%\PSyTricks`, then copy / rename `restricks-server.example.xml` to
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# PSytricks
|
|
2
2
|
|
|
3
|
-

|
|
3
|
+
[](https://pypi.org/project/psytricks/)
|
|
4
4
|

|
|
5
|
-

|
|
6
|
-
](https://imcf.one/apidocs/psytricks)
|
|
6
|
+
[](https://github.com/astral-sh/ruff)
|
|
7
7
|
|
|
8
8
|
`P`ower`S`hell P`y`thon Ci`tri`x Tri`cks` - pun intended.
|
|
9
9
|
|
|
@@ -27,9 +27,9 @@ PSyTricks ships with two options for the PowerShell layer:
|
|
|
27
27
|
obviously this requires the code to be running as a service in an appropriate
|
|
28
28
|
permission context.
|
|
29
29
|
|
|
30
|
-
NOTE: this `RESTful` claim
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
NOTE: this `RESTful` claim isn't fully true. Or actually not at all, it would be
|
|
31
|
+
better called an `HTTP-JSON-RPC-API`. For now, we'll still be using the term
|
|
32
|
+
`REST` for it as the functionality of this package basically serves a very
|
|
33
33
|
similar purpose to what people think of when they are coming across this label.
|
|
34
34
|
Apologies, [Roy T. Fielding][www_rtf].
|
|
35
35
|
|
|
@@ -105,7 +105,7 @@ tried it and how it went!
|
|
|
105
105
|
|
|
106
106
|
To go with **WinSW** simply download the bundled version provided with each
|
|
107
107
|
[PSyTricks release][www_releases]. Just look for the `.zip` asset having `REST`
|
|
108
|
-
and `WinSW` in its name.
|
|
108
|
+
and `WinSW` in its name, matching your .NET version.
|
|
109
109
|
|
|
110
110
|
Unzip the downloaded file to the desired target location, e.g.
|
|
111
111
|
`%PROGRAMDATA%\PSyTricks`, then copy / rename `restricks-server.example.xml` to
|
|
@@ -18,7 +18,7 @@ from .literals import Action, RequestName, MsgStyle
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class ResTricksWrapper:
|
|
21
|
-
"""
|
|
21
|
+
"""Perform requests to a ResTricks service and process the responses.
|
|
22
22
|
|
|
23
23
|
Parameters
|
|
24
24
|
----------
|
|
@@ -91,7 +91,7 @@ class ResTricksWrapper:
|
|
|
91
91
|
log.debug(f"{verb} 'read-only' mode.")
|
|
92
92
|
self._read_only = value
|
|
93
93
|
|
|
94
|
-
def connect(self):
|
|
94
|
+
def connect(self) -> None:
|
|
95
95
|
"""Connect to the ResTricks service unless already connected.
|
|
96
96
|
|
|
97
97
|
Raises
|
|
@@ -127,7 +127,7 @@ class ResTricksWrapper:
|
|
|
127
127
|
f"Connecting to {self.base_url} failed: {ex}"
|
|
128
128
|
) from ex
|
|
129
129
|
|
|
130
|
-
def validate_version(self, server_ver):
|
|
130
|
+
def validate_version(self, server_ver) -> bool:
|
|
131
131
|
"""Validate the server version against the local module.
|
|
132
132
|
|
|
133
133
|
Parse the version strings of the local module and the server response
|
|
@@ -187,7 +187,7 @@ class ResTricksWrapper:
|
|
|
187
187
|
return False
|
|
188
188
|
|
|
189
189
|
@staticmethod
|
|
190
|
-
def _check_response(response):
|
|
190
|
+
def _check_response(response) -> None:
|
|
191
191
|
"""Check the HTTP response code and JSON status attributes."""
|
|
192
192
|
if response.status_code == 200:
|
|
193
193
|
return
|
|
@@ -209,7 +209,9 @@ class ResTricksWrapper:
|
|
|
209
209
|
log.warning(response.text)
|
|
210
210
|
raise ValueError(f"Malformed response: {response.text}") from ex
|
|
211
211
|
|
|
212
|
-
def send_get_request(
|
|
212
|
+
def send_get_request(
|
|
213
|
+
self, raw_url: str, auto_conn: bool = True
|
|
214
|
+
) -> list[dict] | dict | None:
|
|
213
215
|
"""Perform a `GET` request and process the response.
|
|
214
216
|
|
|
215
217
|
Parameters
|
|
@@ -260,7 +262,9 @@ class ResTricksWrapper:
|
|
|
260
262
|
|
|
261
263
|
return data
|
|
262
264
|
|
|
263
|
-
def send_post_request(
|
|
265
|
+
def send_post_request(
|
|
266
|
+
self, raw_url: str, payload: dict, no_json: bool = False
|
|
267
|
+
) -> list[dict] | dict | None:
|
|
264
268
|
"""Perform a `POST` request and process the response.
|
|
265
269
|
|
|
266
270
|
The response will be checked for a valid HTTP status code and will be
|
|
@@ -329,7 +333,23 @@ class ResTricksWrapper:
|
|
|
329
333
|
Returns
|
|
330
334
|
-------
|
|
331
335
|
list(dict)
|
|
332
|
-
The `Data` dicts parsed from the JSON returned by the REST service
|
|
336
|
+
The `Data` dicts parsed from the JSON returned by the REST service
|
|
337
|
+
with the current machine state details. Each dict is expected to
|
|
338
|
+
contain the following keys:
|
|
339
|
+
- `AgentVersion`
|
|
340
|
+
- `AssociatedUserUPNs`
|
|
341
|
+
- `DesktopGroupName`
|
|
342
|
+
- `DNSName`
|
|
343
|
+
- `HostedDNSName`
|
|
344
|
+
- `InMaintenanceMode`
|
|
345
|
+
- `PowerState`
|
|
346
|
+
- `RegistrationState`
|
|
347
|
+
- `SessionClientVersion`
|
|
348
|
+
- `SessionDeviceId`
|
|
349
|
+
- `SessionStartTime`
|
|
350
|
+
- `SessionStateChangeTime`
|
|
351
|
+
- `SessionUserName`
|
|
352
|
+
- `SummaryState`
|
|
333
353
|
"""
|
|
334
354
|
log.debug("Requesting current status of machines...")
|
|
335
355
|
return self.send_get_request("GetMachineStatus")["Data"]
|
|
@@ -341,28 +361,28 @@ class ResTricksWrapper:
|
|
|
341
361
|
-------
|
|
342
362
|
list(dict)
|
|
343
363
|
The `Data` dicts parsed from the JSON returned by the REST service,
|
|
344
|
-
containing details about the currently existing sessions.
|
|
364
|
+
containing details about the currently existing sessions. Each dict
|
|
365
|
+
is expected to contain the following keys:
|
|
366
|
+
- `ClientAddress`
|
|
367
|
+
- `ClientName`
|
|
368
|
+
- `ClientPlatform`
|
|
369
|
+
- `ClientProductId`
|
|
370
|
+
- `ClientVersion`
|
|
371
|
+
- `ConnectedViaHostName`
|
|
372
|
+
- `DesktopGroupName`
|
|
373
|
+
- `DNSName`
|
|
374
|
+
- `MachineSummaryState`
|
|
375
|
+
- `Protocol`
|
|
376
|
+
- `SessionState`
|
|
377
|
+
- `SessionStateChangeTime`
|
|
378
|
+
- `StartTime`
|
|
379
|
+
- `Uid`
|
|
380
|
+
- `UserName`
|
|
381
|
+
- `UserUPN`
|
|
345
382
|
"""
|
|
346
383
|
log.debug("Requesting current sessions...")
|
|
347
384
|
return self.send_get_request("GetSessions")["Data"]
|
|
348
385
|
|
|
349
|
-
def get_access_users(self, group: str) -> list:
|
|
350
|
-
"""Send a `GET` request with `GetAccessUsers`.
|
|
351
|
-
|
|
352
|
-
Parameters
|
|
353
|
-
----------
|
|
354
|
-
group : str
|
|
355
|
-
The name of the Delivery Group to request users having access.
|
|
356
|
-
|
|
357
|
-
Returns
|
|
358
|
-
-------
|
|
359
|
-
list(dict)
|
|
360
|
-
The `Data` dicts parsed from the JSON returned by the REST service,
|
|
361
|
-
containing the user objects having access to the given group.
|
|
362
|
-
"""
|
|
363
|
-
log.debug(f"Requesting users having access to group [{group}]...")
|
|
364
|
-
return self.send_get_request(f"GetAccessUsers/{group}")["Data"]
|
|
365
|
-
|
|
366
386
|
def disconnect_session(self, machine: str) -> dict:
|
|
367
387
|
"""Send a `POST` request with `DisconnectSession`.
|
|
368
388
|
|
|
@@ -379,7 +399,24 @@ class ResTricksWrapper:
|
|
|
379
399
|
contains an empty `Data` object, an empty dict will be returned.
|
|
380
400
|
Please note that sending a disconnect request for a session that is
|
|
381
401
|
already disconnected will not change the session state but still
|
|
382
|
-
return the session details.
|
|
402
|
+
return the session details. The dict is expected to contain the
|
|
403
|
+
following keys:
|
|
404
|
+
- `ClientAddress`
|
|
405
|
+
- `ClientName`
|
|
406
|
+
- `ClientPlatform`
|
|
407
|
+
- `ClientProductId`
|
|
408
|
+
- `ClientVersion`
|
|
409
|
+
- `ConnectedViaHostName`
|
|
410
|
+
- `DesktopGroupName`
|
|
411
|
+
- `DNSName`
|
|
412
|
+
- `MachineSummaryState`
|
|
413
|
+
- `Protocol`
|
|
414
|
+
- `SessionState`
|
|
415
|
+
- `SessionStateChangeTime`
|
|
416
|
+
- `StartTime`
|
|
417
|
+
- `Uid`
|
|
418
|
+
- `UserName`
|
|
419
|
+
- `UserUPN`
|
|
383
420
|
"""
|
|
384
421
|
log.debug(f"Requesting session on [{machine}] to be disconnected...")
|
|
385
422
|
payload = {"DNSName": machine}
|
|
@@ -390,6 +427,34 @@ class ResTricksWrapper:
|
|
|
390
427
|
|
|
391
428
|
return session
|
|
392
429
|
|
|
430
|
+
def get_access_users(self, group: str) -> list:
|
|
431
|
+
"""Send a `GET` request with `GetAccessUsers`.
|
|
432
|
+
|
|
433
|
+
Parameters
|
|
434
|
+
----------
|
|
435
|
+
group : str
|
|
436
|
+
The name of the Delivery Group to request users having access.
|
|
437
|
+
|
|
438
|
+
Returns
|
|
439
|
+
-------
|
|
440
|
+
list(dict)
|
|
441
|
+
The `Data` dicts parsed from the JSON returned by the REST service,
|
|
442
|
+
containing details on the user objects having access to the given
|
|
443
|
+
Delivery Group. Each dict is expected to contain the following keys:
|
|
444
|
+
- `DirectoryContext`
|
|
445
|
+
- `FullName`
|
|
446
|
+
- `HomeZoneName`
|
|
447
|
+
- `HomeZoneUid`
|
|
448
|
+
- `IdentityClaims`
|
|
449
|
+
- `Name`
|
|
450
|
+
- `NameLookupFailureCount`
|
|
451
|
+
- `PrimaryClaim`
|
|
452
|
+
- `SID`
|
|
453
|
+
- `UPN`
|
|
454
|
+
"""
|
|
455
|
+
log.debug(f"Requesting users having access to group [{group}]...")
|
|
456
|
+
return self.send_get_request(f"GetAccessUsers/{group}")["Data"]
|
|
457
|
+
|
|
393
458
|
def set_access_users(self, group: str, users: str, disable: bool) -> list:
|
|
394
459
|
"""Send a `POST` request with `SetAccessUsers`.
|
|
395
460
|
|
|
@@ -409,8 +474,19 @@ class ResTricksWrapper:
|
|
|
409
474
|
-------
|
|
410
475
|
list(dict)
|
|
411
476
|
The `Data` dicts parsed from the JSON returned by the REST service,
|
|
412
|
-
containing the user objects having access to the given
|
|
413
|
-
the operation has been performed.
|
|
477
|
+
containing the user objects having access to the given Delivery
|
|
478
|
+
Group *after* the operation has been performed. Each dict is
|
|
479
|
+
expected to contain the following keys:
|
|
480
|
+
- `DirectoryContext`
|
|
481
|
+
- `FullName`
|
|
482
|
+
- `HomeZoneName`
|
|
483
|
+
- `HomeZoneUid`
|
|
484
|
+
- `IdentityClaims`
|
|
485
|
+
- `Name`
|
|
486
|
+
- `NameLookupFailureCount`
|
|
487
|
+
- `PrimaryClaim`
|
|
488
|
+
- `SID`
|
|
489
|
+
- `UPN`
|
|
414
490
|
"""
|
|
415
491
|
verb = "Removing" if disable else "Adding"
|
|
416
492
|
log.debug(f"{verb} access to group [{group}] for user(s) [{users}]...")
|
|
@@ -436,6 +512,21 @@ class ResTricksWrapper:
|
|
|
436
512
|
-------
|
|
437
513
|
dict
|
|
438
514
|
The `Data` dict parsed from the JSON returned by the REST service.
|
|
515
|
+
It is expected to contain the following keys:
|
|
516
|
+
- `AgentVersion`
|
|
517
|
+
- `AssociatedUserUPNs`
|
|
518
|
+
- `DesktopGroupName`
|
|
519
|
+
- `DNSName`
|
|
520
|
+
- `HostedDNSName`
|
|
521
|
+
- `InMaintenanceMode`
|
|
522
|
+
- `PowerState`
|
|
523
|
+
- `RegistrationState`
|
|
524
|
+
- `SessionClientVersion`
|
|
525
|
+
- `SessionDeviceId`
|
|
526
|
+
- `SessionStartTime`
|
|
527
|
+
- `SessionStateChangeTime`
|
|
528
|
+
- `SessionUserName`
|
|
529
|
+
- `SummaryState`
|
|
439
530
|
"""
|
|
440
531
|
verb = "Disabling" if disable else "Enabling"
|
|
441
532
|
log.debug(f"{verb} maintenance mode on [{machine}]...")
|
|
@@ -445,7 +536,9 @@ class ResTricksWrapper:
|
|
|
445
536
|
}
|
|
446
537
|
return self.send_post_request("SetMaintenanceMode", payload)["Data"]
|
|
447
538
|
|
|
448
|
-
def send_message(
|
|
539
|
+
def send_message(
|
|
540
|
+
self, machine: str, message: str, title: str, style: MsgStyle
|
|
541
|
+
) -> None:
|
|
449
542
|
"""Send a `POST` request with `SendSessionMessage`.
|
|
450
543
|
|
|
451
544
|
Parameters
|
|
@@ -483,7 +576,26 @@ class ResTricksWrapper:
|
|
|
483
576
|
-------
|
|
484
577
|
dict
|
|
485
578
|
The `Data` dict parsed from the JSON returned by the REST service
|
|
486
|
-
containing details on the power action status of the machine.
|
|
579
|
+
containing details on the power action status of the machine. The
|
|
580
|
+
dict is expected to contain the following keys:
|
|
581
|
+
- `Action`
|
|
582
|
+
- `ActionCompletionTime`
|
|
583
|
+
- `ActionStartTime`
|
|
584
|
+
- `ActualPriority`
|
|
585
|
+
- `BasePriority`
|
|
586
|
+
- `DNSName`
|
|
587
|
+
- `FailureReason`
|
|
588
|
+
- `HostedMachineId`
|
|
589
|
+
- `HostedMachineName`
|
|
590
|
+
- `HypHypervisorConnectionUid`
|
|
591
|
+
- `HypervisorConnectionUid`
|
|
592
|
+
- `MachineName`
|
|
593
|
+
- `MetadataMap`
|
|
594
|
+
- `Origin`
|
|
595
|
+
- `RequestTime`
|
|
596
|
+
- `Sid`
|
|
597
|
+
- `State`
|
|
598
|
+
- `Uid`
|
|
487
599
|
"""
|
|
488
600
|
log.debug(f"Requesting action [{action}] for machine [{machine}]...")
|
|
489
601
|
payload = {
|
|
@@ -547,7 +659,9 @@ class PSyTricksWrapper:
|
|
|
547
659
|
log.debug(f"Using PowerShell script [{self.pswrapper}].")
|
|
548
660
|
log.debug(f"Using Delivery Controller [{self.deliverycontroller}].")
|
|
549
661
|
|
|
550
|
-
def run_ps1_script(
|
|
662
|
+
def run_ps1_script(
|
|
663
|
+
self, request: RequestName, extra_params: (list | None) = None
|
|
664
|
+
) -> list[dict] | dict | None:
|
|
551
665
|
"""Call the PowerShell wrapper to retrieve information from Citrix.
|
|
552
666
|
|
|
553
667
|
Parameters
|
|
@@ -560,9 +674,10 @@ class PSyTricksWrapper:
|
|
|
560
674
|
|
|
561
675
|
Returns
|
|
562
676
|
-------
|
|
563
|
-
list(
|
|
677
|
+
list(dict) or dict or None
|
|
564
678
|
The "Data" section of the JSON parsed from the output returned by
|
|
565
|
-
the PS1 wrapper script.
|
|
679
|
+
the PS1 wrapper script. Depending on the command, this can be a list
|
|
680
|
+
of dicts or a single dict or None.
|
|
566
681
|
|
|
567
682
|
Raises
|
|
568
683
|
------
|
|
@@ -612,6 +727,7 @@ class PSyTricksWrapper:
|
|
|
612
727
|
f"Call returned a non-zero state: {ex.returncode} {ex.stderr}"
|
|
613
728
|
) from ex
|
|
614
729
|
|
|
730
|
+
stdout = "PRE-DECODING-DUMMY-VALUE"
|
|
615
731
|
try:
|
|
616
732
|
tstart = time.time()
|
|
617
733
|
stdout = completed.stdout.decode(encoding="cp850")
|
|
@@ -650,8 +766,23 @@ class PSyTricksWrapper:
|
|
|
650
766
|
|
|
651
767
|
Returns
|
|
652
768
|
-------
|
|
653
|
-
list(
|
|
654
|
-
|
|
769
|
+
list(dict)
|
|
770
|
+
A list of dicts with the current machine state details. Each dict is
|
|
771
|
+
expected to contain the following keys:
|
|
772
|
+
- `AgentVersion`
|
|
773
|
+
- `AssociatedUserUPNs`
|
|
774
|
+
- `DesktopGroupName`
|
|
775
|
+
- `DNSName`
|
|
776
|
+
- `HostedDNSName`
|
|
777
|
+
- `InMaintenanceMode`
|
|
778
|
+
- `PowerState`
|
|
779
|
+
- `RegistrationState`
|
|
780
|
+
- `SessionClientVersion`
|
|
781
|
+
- `SessionDeviceId`
|
|
782
|
+
- `SessionStartTime`
|
|
783
|
+
- `SessionStateChangeTime`
|
|
784
|
+
- `SessionUserName`
|
|
785
|
+
- `SummaryState`
|
|
655
786
|
"""
|
|
656
787
|
return self.run_ps1_script(request="GetMachineStatus")
|
|
657
788
|
|
|
@@ -660,12 +791,29 @@ class PSyTricksWrapper:
|
|
|
660
791
|
|
|
661
792
|
Returns
|
|
662
793
|
-------
|
|
663
|
-
list(
|
|
664
|
-
|
|
794
|
+
list(dict)
|
|
795
|
+
A list of dicts with the current session details. Each dict is
|
|
796
|
+
expected to contain the following keys:
|
|
797
|
+
- `ClientAddress`
|
|
798
|
+
- `ClientName`
|
|
799
|
+
- `ClientPlatform`
|
|
800
|
+
- `ClientProductId`
|
|
801
|
+
- `ClientVersion`
|
|
802
|
+
- `ConnectedViaHostName`
|
|
803
|
+
- `DesktopGroupName`
|
|
804
|
+
- `DNSName`
|
|
805
|
+
- `MachineSummaryState`
|
|
806
|
+
- `Protocol`
|
|
807
|
+
- `SessionState`
|
|
808
|
+
- `SessionStateChangeTime`
|
|
809
|
+
- `StartTime`
|
|
810
|
+
- `Uid`
|
|
811
|
+
- `UserName`
|
|
812
|
+
- `UserUPN`
|
|
665
813
|
"""
|
|
666
814
|
return self.run_ps1_script(request="GetSessions")
|
|
667
815
|
|
|
668
|
-
def disconnect_session(self, machine: str) ->
|
|
816
|
+
def disconnect_session(self, machine: str) -> dict:
|
|
669
817
|
"""Call the wrapper with command `DisconnectSession`.
|
|
670
818
|
|
|
671
819
|
Parameters
|
|
@@ -675,8 +823,26 @@ class PSyTricksWrapper:
|
|
|
675
823
|
|
|
676
824
|
Returns
|
|
677
825
|
-------
|
|
678
|
-
|
|
679
|
-
|
|
826
|
+
dict
|
|
827
|
+
A dict with the details on the session that was requested to be
|
|
828
|
+
disconnected. The dict is expected to contain the following keys:
|
|
829
|
+
- `ClientAddress`
|
|
830
|
+
- `ClientName`
|
|
831
|
+
- `ClientPlatform`
|
|
832
|
+
- `ClientProductId`
|
|
833
|
+
- `ClientVersion`
|
|
834
|
+
- `ConnectedViaHostName`
|
|
835
|
+
- `DesktopGroupName`
|
|
836
|
+
- `DNSName`
|
|
837
|
+
- `MachineSummaryState`
|
|
838
|
+
- `Protocol`
|
|
839
|
+
- `SessionState`
|
|
840
|
+
- `SessionStateChangeTime`
|
|
841
|
+
- `StartTime`
|
|
842
|
+
- `Uid`
|
|
843
|
+
- `UserName`
|
|
844
|
+
- `UserUPN`
|
|
845
|
+
|
|
680
846
|
"""
|
|
681
847
|
return self.run_ps1_script(
|
|
682
848
|
request="DisconnectSession",
|
|
@@ -693,8 +859,20 @@ class PSyTricksWrapper:
|
|
|
693
859
|
|
|
694
860
|
Returns
|
|
695
861
|
-------
|
|
696
|
-
list(
|
|
697
|
-
|
|
862
|
+
list(dict)
|
|
863
|
+
A list of dicts with the details on the user objects having access
|
|
864
|
+
to the given Delivery Group. Each dict is expected to contain the
|
|
865
|
+
following keys:
|
|
866
|
+
- `DirectoryContext`
|
|
867
|
+
- `FullName`
|
|
868
|
+
- `HomeZoneName`
|
|
869
|
+
- `HomeZoneUid`
|
|
870
|
+
- `IdentityClaims`
|
|
871
|
+
- `Name`
|
|
872
|
+
- `NameLookupFailureCount`
|
|
873
|
+
- `PrimaryClaim`
|
|
874
|
+
- `SID`
|
|
875
|
+
- `UPN`
|
|
698
876
|
"""
|
|
699
877
|
return self.run_ps1_script(
|
|
700
878
|
request="GetAccessUsers",
|
|
@@ -717,8 +895,20 @@ class PSyTricksWrapper:
|
|
|
717
895
|
|
|
718
896
|
Returns
|
|
719
897
|
-------
|
|
720
|
-
list(
|
|
721
|
-
|
|
898
|
+
list(dict)
|
|
899
|
+
A list of dicts with the details on the user objects having access
|
|
900
|
+
to the given Delivery Group *after* the operation has been
|
|
901
|
+
performed. Each dict is expected to contain the following keys:
|
|
902
|
+
- `DirectoryContext`
|
|
903
|
+
- `FullName`
|
|
904
|
+
- `HomeZoneName`
|
|
905
|
+
- `HomeZoneUid`
|
|
906
|
+
- `IdentityClaims`
|
|
907
|
+
- `Name`
|
|
908
|
+
- `NameLookupFailureCount`
|
|
909
|
+
- `PrimaryClaim`
|
|
910
|
+
- `SID`
|
|
911
|
+
- `UPN`
|
|
722
912
|
"""
|
|
723
913
|
extra_params = [
|
|
724
914
|
"-Group",
|
|
@@ -731,7 +921,7 @@ class PSyTricksWrapper:
|
|
|
731
921
|
|
|
732
922
|
return self.run_ps1_script(request="SetAccessUsers", extra_params=extra_params)
|
|
733
923
|
|
|
734
|
-
def set_maintenance(self, machine: str, disable: bool) ->
|
|
924
|
+
def set_maintenance(self, machine: str, disable: bool) -> dict:
|
|
735
925
|
"""Call the wrapper with command `SetMaintenanceMode`.
|
|
736
926
|
|
|
737
927
|
Parameters
|
|
@@ -744,8 +934,23 @@ class PSyTricksWrapper:
|
|
|
744
934
|
|
|
745
935
|
Returns
|
|
746
936
|
-------
|
|
747
|
-
|
|
748
|
-
|
|
937
|
+
dict
|
|
938
|
+
A dict created from the parsed JSON as returned by the wrapper
|
|
939
|
+
script. The dict is expected to contain the following keys:
|
|
940
|
+
- `AgentVersion`
|
|
941
|
+
- `AssociatedUserUPNs`
|
|
942
|
+
- `DesktopGroupName`
|
|
943
|
+
- `DNSName`
|
|
944
|
+
- `HostedDNSName`
|
|
945
|
+
- `InMaintenanceMode`
|
|
946
|
+
- `PowerState`
|
|
947
|
+
- `RegistrationState`
|
|
948
|
+
- `SessionClientVersion`
|
|
949
|
+
- `SessionDeviceId`
|
|
950
|
+
- `SessionStartTime`
|
|
951
|
+
- `SessionStateChangeTime`
|
|
952
|
+
- `SessionUserName`
|
|
953
|
+
- `SummaryState`
|
|
749
954
|
"""
|
|
750
955
|
extra_params = ["-DNSName", machine]
|
|
751
956
|
if disable:
|
|
@@ -755,7 +960,9 @@ class PSyTricksWrapper:
|
|
|
755
960
|
request="SetMaintenanceMode", extra_params=extra_params
|
|
756
961
|
)
|
|
757
962
|
|
|
758
|
-
def send_message(
|
|
963
|
+
def send_message(
|
|
964
|
+
self, machine: str, message: str, title: str, style: MsgStyle
|
|
965
|
+
) -> None:
|
|
759
966
|
"""Call the wrapper with command `SendSessionMessage`.
|
|
760
967
|
|
|
761
968
|
Parameters
|
|
@@ -783,7 +990,7 @@ class PSyTricksWrapper:
|
|
|
783
990
|
|
|
784
991
|
self.run_ps1_script(request="SendSessionMessage", extra_params=extra_params)
|
|
785
992
|
|
|
786
|
-
def perform_poweraction(self, machine: str, action: Action) ->
|
|
993
|
+
def perform_poweraction(self, machine: str, action: Action) -> dict:
|
|
787
994
|
"""Call the wrapper with command `MachinePowerAction`.
|
|
788
995
|
|
|
789
996
|
Parameters
|
|
@@ -792,6 +999,31 @@ class PSyTricksWrapper:
|
|
|
792
999
|
The FQDN of the machine to disconnect the session on.
|
|
793
1000
|
action : str
|
|
794
1001
|
The power action to perform, one of `psytricks.literals.Action`.
|
|
1002
|
+
|
|
1003
|
+
Returns
|
|
1004
|
+
-------
|
|
1005
|
+
dict
|
|
1006
|
+
The `Data` dict parsed from the JSON returned by the wrapper script,
|
|
1007
|
+
containing details on the power action status of the machine. The
|
|
1008
|
+
dict is expected to contain the following keys:
|
|
1009
|
+
- `Action`
|
|
1010
|
+
- `ActionCompletionTime`
|
|
1011
|
+
- `ActionStartTime`
|
|
1012
|
+
- `ActualPriority`
|
|
1013
|
+
- `BasePriority`
|
|
1014
|
+
- `DNSName`
|
|
1015
|
+
- `FailureReason`
|
|
1016
|
+
- `HostedMachineId`
|
|
1017
|
+
- `HostedMachineName`
|
|
1018
|
+
- `HypHypervisorConnectionUid`
|
|
1019
|
+
- `HypervisorConnectionUid`
|
|
1020
|
+
- `MachineName`
|
|
1021
|
+
- `MetadataMap`
|
|
1022
|
+
- `Origin`
|
|
1023
|
+
- `RequestTime`
|
|
1024
|
+
- `Sid`
|
|
1025
|
+
- `State`
|
|
1026
|
+
- `Uid`
|
|
795
1027
|
"""
|
|
796
1028
|
extra_params = ["-DNSName", machine, "-Action", action]
|
|
797
1029
|
return self.run_ps1_script(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/sampledata/GetAccessUsers.json
RENAMED
|
File without changes
|
{psytricks-2.2.0a9 → psytricks-2.2.0a18}/src/psytricks/__ps1__/sampledata/GetMachineStatus.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|