python-openstackclient 9.0.0__py3-none-any.whl → 10.0.0__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.
- openstackclient/__init__.py +2 -6
- openstackclient/api/api.py +41 -23
- openstackclient/api/compute_v2.py +44 -25
- openstackclient/api/object_store_v1.py +75 -97
- openstackclient/api/volume_v2.py +2 -1
- openstackclient/api/volume_v3.py +2 -1
- openstackclient/common/availability_zone.py +58 -42
- openstackclient/common/clientmanager.py +56 -29
- openstackclient/common/configuration.py +10 -3
- openstackclient/common/envvars.py +2 -2
- openstackclient/common/extension.py +14 -5
- openstackclient/common/limits.py +10 -5
- openstackclient/common/module.py +14 -6
- openstackclient/common/pagination.py +8 -2
- openstackclient/common/progressbar.py +7 -6
- openstackclient/common/project_cleanup.py +13 -7
- openstackclient/common/quota.py +97 -99
- openstackclient/common/versions.py +8 -2
- openstackclient/compute/client.py +7 -3
- openstackclient/compute/v2/agent.py +17 -10
- openstackclient/compute/v2/aggregate.py +36 -22
- openstackclient/compute/v2/console.py +14 -8
- openstackclient/compute/v2/console_connection.py +11 -3
- openstackclient/compute/v2/flavor.py +39 -21
- openstackclient/compute/v2/host.py +14 -6
- openstackclient/compute/v2/hypervisor.py +14 -5
- openstackclient/compute/v2/hypervisor_stats.py +10 -2
- openstackclient/compute/v2/keypair.py +29 -14
- openstackclient/compute/v2/server.py +249 -169
- openstackclient/compute/v2/server_backup.py +10 -4
- openstackclient/compute/v2/server_event.py +21 -12
- openstackclient/compute/v2/server_group.py +21 -11
- openstackclient/compute/v2/server_image.py +19 -10
- openstackclient/compute/v2/server_migration.py +24 -10
- openstackclient/compute/v2/server_share.py +274 -0
- openstackclient/compute/v2/server_volume.py +10 -4
- openstackclient/compute/v2/service.py +14 -7
- openstackclient/compute/v2/usage.py +26 -21
- openstackclient/identity/client.py +8 -3
- openstackclient/identity/common.py +78 -47
- openstackclient/identity/v2_0/catalog.py +14 -7
- openstackclient/identity/v2_0/ec2creds.py +21 -10
- openstackclient/identity/v2_0/endpoint.py +23 -11
- openstackclient/identity/v2_0/project.py +25 -14
- openstackclient/identity/v2_0/role.py +28 -14
- openstackclient/identity/v2_0/role_assignment.py +9 -3
- openstackclient/identity/v2_0/service.py +23 -11
- openstackclient/identity/v2_0/token.py +12 -5
- openstackclient/identity/v2_0/user.py +26 -15
- openstackclient/identity/v3/access_rule.py +26 -12
- openstackclient/identity/v3/application_credential.py +59 -24
- openstackclient/identity/v3/catalog.py +14 -7
- openstackclient/identity/v3/consumer.py +22 -11
- openstackclient/identity/v3/credential.py +36 -16
- openstackclient/identity/v3/domain.py +37 -18
- openstackclient/identity/v3/ec2creds.py +25 -12
- openstackclient/identity/v3/endpoint.py +42 -20
- openstackclient/identity/v3/endpoint_group.py +28 -17
- openstackclient/identity/v3/federation_protocol.py +38 -16
- openstackclient/identity/v3/group.py +55 -32
- openstackclient/identity/v3/identity_provider.py +92 -57
- openstackclient/identity/v3/implied_role.py +21 -9
- openstackclient/identity/v3/limit.py +38 -16
- openstackclient/identity/v3/mapping.py +26 -13
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +43 -23
- openstackclient/identity/v3/region.py +36 -16
- openstackclient/identity/v3/registered_limit.py +40 -16
- openstackclient/identity/v3/role.py +61 -31
- openstackclient/identity/v3/role_assignment.py +23 -6
- openstackclient/identity/v3/service.py +36 -16
- openstackclient/identity/v3/service_provider.py +37 -15
- openstackclient/identity/v3/tag.py +23 -6
- openstackclient/identity/v3/token.py +30 -14
- openstackclient/identity/v3/trust.py +32 -14
- openstackclient/identity/v3/unscoped_saml.py +10 -2
- openstackclient/identity/v3/user.py +49 -26
- openstackclient/image/client.py +7 -3
- openstackclient/image/v1/image.py +33 -26
- openstackclient/image/v2/cache.py +14 -9
- openstackclient/image/v2/image.py +74 -48
- openstackclient/image/v2/info.py +7 -1
- openstackclient/image/v2/metadef_namespaces.py +109 -13
- openstackclient/image/v2/metadef_objects.py +28 -15
- openstackclient/image/v2/metadef_properties.py +24 -13
- openstackclient/image/v2/metadef_resource_type_association.py +14 -7
- openstackclient/image/v2/metadef_resource_types.py +7 -1
- openstackclient/image/v2/task.py +15 -6
- openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +7 -192
- openstackclient/network/client.py +7 -2
- openstackclient/network/common.py +16 -241
- openstackclient/network/utils.py +36 -22
- openstackclient/network/v2/address_group.py +27 -16
- openstackclient/network/v2/address_scope.py +24 -13
- openstackclient/network/v2/bgpvpn/bgpvpn.py +463 -0
- openstackclient/network/v2/bgpvpn/constants.py +30 -0
- openstackclient/network/v2/bgpvpn/network_association.py +214 -0
- openstackclient/network/v2/bgpvpn/port_association.py +490 -0
- openstackclient/network/v2/bgpvpn/router_association.py +288 -0
- openstackclient/network/v2/default_security_group_rule.py +19 -10
- openstackclient/network/v2/floating_ip.py +110 -159
- openstackclient/network/v2/floating_ip_port_forwarding.py +30 -18
- openstackclient/network/v2/fwaas/__init__.py +0 -0
- openstackclient/network/v2/fwaas/group.py +466 -0
- openstackclient/network/v2/fwaas/policy.py +518 -0
- openstackclient/network/v2/fwaas/rule.py +574 -0
- openstackclient/network/v2/ip_availability.py +13 -5
- openstackclient/network/v2/l3_conntrack_helper.py +22 -13
- openstackclient/network/v2/local_ip.py +24 -13
- openstackclient/network/v2/local_ip_association.py +14 -7
- openstackclient/network/v2/ndp_proxy.py +20 -11
- openstackclient/network/v2/network.py +129 -196
- openstackclient/network/v2/network_agent.py +46 -25
- openstackclient/network/v2/network_auto_allocated_topology.py +22 -11
- openstackclient/network/v2/network_flavor.py +27 -16
- openstackclient/network/v2/network_flavor_profile.py +23 -12
- openstackclient/network/v2/network_meter.py +21 -10
- openstackclient/network/v2/network_meter_rule.py +21 -11
- openstackclient/network/v2/network_qos_policy.py +25 -15
- openstackclient/network/v2/network_qos_rule.py +32 -17
- openstackclient/network/v2/network_qos_rule_type.py +13 -5
- openstackclient/network/v2/network_rbac.py +23 -12
- openstackclient/network/v2/network_segment.py +20 -11
- openstackclient/network/v2/network_segment_range.py +56 -29
- openstackclient/network/v2/network_service_provider.py +7 -1
- openstackclient/network/v2/network_trunk.py +38 -22
- openstackclient/network/v2/port.py +54 -29
- openstackclient/network/v2/router.py +75 -52
- openstackclient/network/v2/security_group.py +87 -157
- openstackclient/network/v2/security_group_rule.py +100 -280
- openstackclient/network/v2/subnet.py +49 -28
- openstackclient/network/v2/subnet_pool.py +30 -17
- openstackclient/network/v2/taas/tap_flow.py +22 -11
- openstackclient/network/v2/taas/tap_mirror.py +22 -11
- openstackclient/network/v2/taas/tap_service.py +23 -12
- openstackclient/object/client.py +7 -2
- openstackclient/object/v1/account.py +13 -6
- openstackclient/object/v1/container.py +25 -15
- openstackclient/object/v1/object.py +25 -15
- openstackclient/py.typed +0 -0
- openstackclient/shell.py +46 -10
- openstackclient/tests/functional/base.py +55 -20
- openstackclient/tests/functional/common/test_extension.py +4 -0
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +14 -13
- openstackclient/tests/functional/compute/v2/test_flavor.py +3 -1
- openstackclient/tests/functional/compute/v2/test_server.py +3 -0
- openstackclient/tests/functional/identity/v2/common.py +10 -6
- openstackclient/tests/functional/identity/v2/test_role.py +4 -4
- openstackclient/tests/functional/identity/v3/common.py +25 -19
- openstackclient/tests/functional/identity/v3/test_group.py +20 -20
- openstackclient/tests/functional/identity/v3/test_idp.py +3 -1
- openstackclient/tests/functional/identity/v3/test_project.py +10 -10
- openstackclient/tests/functional/identity/v3/test_role.py +18 -18
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +12 -12
- openstackclient/tests/functional/identity/v3/test_user.py +8 -8
- openstackclient/tests/functional/image/base.py +1 -6
- openstackclient/tests/functional/network/v2/common.py +5 -2
- openstackclient/tests/functional/network/v2/test_floating_ip.py +10 -4
- openstackclient/tests/functional/network/v2/test_ip_availability.py +4 -0
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +3 -2
- openstackclient/tests/functional/network/v2/test_network_segment.py +5 -0
- openstackclient/tests/functional/network/v2/test_subnet.py +13 -9
- openstackclient/tests/functional/object/v1/common.py +4 -0
- openstackclient/tests/functional/volume/v2/common.py +4 -0
- openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +27 -11
- openstackclient/tests/functional/volume/v2/test_volume_type.py +2 -2
- openstackclient/tests/functional/volume/v3/common.py +4 -0
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +11 -7
- openstackclient/tests/functional/volume/v3/test_volume_type.py +2 -2
- openstackclient/tests/unit/common/test_availability_zone.py +35 -49
- openstackclient/tests/unit/common/test_extension.py +2 -2
- openstackclient/tests/unit/common/test_module.py +12 -7
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +6 -26
- openstackclient/tests/unit/compute/v2/fakes.py +25 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +28 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +6 -6
- openstackclient/tests/unit/compute/v2/test_server.py +11 -96
- openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
- openstackclient/tests/unit/identity/v3/fakes.py +3 -0
- openstackclient/tests/unit/identity/v3/test_group.py +4 -14
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
- openstackclient/tests/unit/identity/v3/test_user.py +4 -4
- openstackclient/tests/unit/image/v2/test_image.py +11 -11
- openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +105 -6
- openstackclient/tests/unit/network/test_common.py +0 -155
- openstackclient/tests/unit/network/v2/bgpvpn/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/bgpvpn/fakes.py +179 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_bgpvpn.py +584 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_network_association.py +285 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_port_association.py +384 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_router_association.py +297 -0
- openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +897 -0
- openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +980 -0
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_flow.py → test_tap_flow.py} +18 -25
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_mirror.py → test_tap_mirror.py} +19 -29
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_service.py → test_tap_service.py} +19 -29
- openstackclient/tests/unit/network/v2/test_address_group.py +2 -2
- openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +3 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +13 -13
- openstackclient/tests/unit/network/v2/test_network_agent.py +8 -4
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
- openstackclient/tests/unit/network/v2/test_network_flavor.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_rbac.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +7 -10
- openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/unit/network/v2/test_router.py +8 -9
- openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +1 -20
- openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +7 -41
- openstackclient/tests/unit/network/v2/test_subnet.py +2 -1
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +2 -1
- openstackclient/tests/unit/object/v1/fakes.py +8 -7
- openstackclient/tests/unit/object/v1/test_container.py +65 -101
- openstackclient/tests/unit/object/v1/test_container_all.py +8 -1
- openstackclient/tests/unit/object/v1/test_object.py +44 -84
- openstackclient/tests/unit/object/v1/test_object_all.py +8 -1
- openstackclient/tests/unit/test_hacking.py +108 -0
- openstackclient/tests/unit/volume/v2/fakes.py +1 -0
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +2 -1
- openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
- openstackclient/tests/unit/volume/v3/fakes.py +1 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +60 -3
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +55 -1
- openstackclient/tests/unit/volume/v3/test_volume_type.py +2 -4
- openstackclient/volume/client.py +7 -3
- openstackclient/volume/v2/backup_record.py +15 -6
- openstackclient/volume/v2/consistency_group.py +29 -17
- openstackclient/volume/v2/consistency_group_snapshot.py +25 -10
- openstackclient/volume/v2/qos_specs.py +28 -17
- openstackclient/volume/v2/service.py +17 -6
- openstackclient/volume/v2/volume.py +57 -29
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +46 -20
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +50 -24
- openstackclient/volume/v2/volume_transfer_request.py +31 -13
- openstackclient/volume/v2/volume_type.py +43 -24
- openstackclient/volume/v3/block_storage_cleanup.py +11 -3
- openstackclient/volume/v3/block_storage_cluster.py +19 -7
- openstackclient/volume/v3/block_storage_log_level.py +15 -6
- openstackclient/volume/v3/block_storage_manage.py +10 -4
- openstackclient/volume/v3/block_storage_resource_filter.py +17 -5
- openstackclient/volume/v3/service.py +16 -6
- openstackclient/volume/v3/volume.py +89 -39
- openstackclient/volume/v3/volume_attachment.py +43 -21
- openstackclient/volume/v3/volume_backup.py +53 -24
- openstackclient/volume/v3/volume_group.py +23 -13
- openstackclient/volume/v3/volume_group_snapshot.py +32 -13
- openstackclient/volume/v3/volume_group_type.py +26 -13
- openstackclient/volume/v3/volume_message.py +15 -7
- openstackclient/volume/v3/volume_snapshot.py +69 -32
- openstackclient/volume/v3/volume_transfer_request.py +31 -13
- openstackclient/volume/v3/volume_type.py +42 -24
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/METADATA +6 -6
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/RECORD +271 -260
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/entry_points.txt +53 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/AUTHORS +4 -0
- python_openstackclient-10.0.0.dist-info/pbr.json +1 -0
- openstackclient/api/image_v1.py +0 -69
- openstackclient/api/image_v2.py +0 -79
- openstackclient/network/v2/floating_ip_pool.py +0 -38
- openstackclient/tests/functional/image/v1/test_image.py +0 -97
- openstackclient/tests/unit/api/test_image_v1.py +0 -96
- openstackclient/tests/unit/api/test_image_v2.py +0 -96
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +0 -248
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +0 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +0 -39
- openstackclient/tests/unit/network/v2/test_network_compute.py +0 -404
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +0 -392
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +0 -555
- python_openstackclient-9.0.0.dist-info/pbr.json +0 -1
- /openstackclient/{tests/functional/image/v1 → network/v2/bgpvpn}/__init__.py +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/top_level.txt +0 -0
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v2.0 User action implementations"""
|
|
17
17
|
|
|
18
|
+
import argparse
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
18
20
|
import functools
|
|
19
21
|
import logging
|
|
22
|
+
from typing import Any, cast
|
|
20
23
|
|
|
21
24
|
from cliff import columns as cliff_columns
|
|
22
25
|
from keystoneauth1 import exceptions as ks_exc
|
|
@@ -41,16 +44,16 @@ class ProjectColumn(cliff_columns.FormattableColumn[str]):
|
|
|
41
44
|
``functools.partial(ProjectColumn, project_cache)``.
|
|
42
45
|
"""
|
|
43
46
|
|
|
44
|
-
def __init__(self, value, project_cache=None):
|
|
47
|
+
def __init__(self, value: str, project_cache: Any = None) -> None:
|
|
45
48
|
super().__init__(value)
|
|
46
49
|
self.project_cache = project_cache or {}
|
|
47
50
|
|
|
48
|
-
def human_readable(self):
|
|
51
|
+
def human_readable(self) -> str:
|
|
49
52
|
project = self._value
|
|
50
53
|
if not project:
|
|
51
54
|
return ""
|
|
52
55
|
if project in self.project_cache.keys():
|
|
53
|
-
return self.project_cache[project].name
|
|
56
|
+
return cast(str, self.project_cache[project].name)
|
|
54
57
|
else:
|
|
55
58
|
return project
|
|
56
59
|
|
|
@@ -58,7 +61,7 @@ class ProjectColumn(cliff_columns.FormattableColumn[str]):
|
|
|
58
61
|
class CreateUser(command.ShowOne):
|
|
59
62
|
_description = _("Create new user")
|
|
60
63
|
|
|
61
|
-
def get_parser(self, prog_name):
|
|
64
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
62
65
|
parser = super().get_parser(prog_name)
|
|
63
66
|
parser.add_argument(
|
|
64
67
|
'name',
|
|
@@ -104,7 +107,9 @@ class CreateUser(command.ShowOne):
|
|
|
104
107
|
)
|
|
105
108
|
return parser
|
|
106
109
|
|
|
107
|
-
def take_action(
|
|
110
|
+
def take_action(
|
|
111
|
+
self, parsed_args: argparse.Namespace
|
|
112
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
108
113
|
identity_client = self.app.client_manager.identity
|
|
109
114
|
|
|
110
115
|
if parsed_args.project:
|
|
@@ -155,13 +160,14 @@ class CreateUser(command.ShowOne):
|
|
|
155
160
|
|
|
156
161
|
info = {}
|
|
157
162
|
info.update(user._info)
|
|
158
|
-
|
|
163
|
+
col_headers, col_data = zip(*sorted(info.items()))
|
|
164
|
+
return col_headers, col_data
|
|
159
165
|
|
|
160
166
|
|
|
161
167
|
class DeleteUser(command.Command):
|
|
162
168
|
_description = _("Delete user(s)")
|
|
163
169
|
|
|
164
|
-
def get_parser(self, prog_name):
|
|
170
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
165
171
|
parser = super().get_parser(prog_name)
|
|
166
172
|
parser.add_argument(
|
|
167
173
|
'users',
|
|
@@ -171,7 +177,7 @@ class DeleteUser(command.Command):
|
|
|
171
177
|
)
|
|
172
178
|
return parser
|
|
173
179
|
|
|
174
|
-
def take_action(self, parsed_args):
|
|
180
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
175
181
|
identity_client = self.app.client_manager.identity
|
|
176
182
|
|
|
177
183
|
errors = 0
|
|
@@ -204,7 +210,7 @@ class DeleteUser(command.Command):
|
|
|
204
210
|
class ListUser(command.Lister):
|
|
205
211
|
_description = _("List users")
|
|
206
212
|
|
|
207
|
-
def get_parser(self, prog_name):
|
|
213
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
208
214
|
parser = super().get_parser(prog_name)
|
|
209
215
|
parser.add_argument(
|
|
210
216
|
'--project',
|
|
@@ -219,7 +225,9 @@ class ListUser(command.Lister):
|
|
|
219
225
|
)
|
|
220
226
|
return parser
|
|
221
227
|
|
|
222
|
-
def take_action(
|
|
228
|
+
def take_action(
|
|
229
|
+
self, parsed_args: argparse.Namespace
|
|
230
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
223
231
|
identity_client = self.app.client_manager.identity
|
|
224
232
|
formatters = {}
|
|
225
233
|
project = None
|
|
@@ -278,7 +286,7 @@ class ListUser(command.Lister):
|
|
|
278
286
|
class SetUser(command.Command):
|
|
279
287
|
_description = _("Set user properties")
|
|
280
288
|
|
|
281
|
-
def get_parser(self, prog_name):
|
|
289
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
282
290
|
parser = super().get_parser(prog_name)
|
|
283
291
|
parser.add_argument(
|
|
284
292
|
'user',
|
|
@@ -324,7 +332,7 @@ class SetUser(command.Command):
|
|
|
324
332
|
)
|
|
325
333
|
return parser
|
|
326
334
|
|
|
327
|
-
def take_action(self, parsed_args):
|
|
335
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
328
336
|
identity_client = self.app.client_manager.identity
|
|
329
337
|
|
|
330
338
|
if parsed_args.password_prompt:
|
|
@@ -376,7 +384,7 @@ class SetUser(command.Command):
|
|
|
376
384
|
class ShowUser(command.ShowOne):
|
|
377
385
|
_description = _("Display user details")
|
|
378
386
|
|
|
379
|
-
def get_parser(self, prog_name):
|
|
387
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
380
388
|
parser = super().get_parser(prog_name)
|
|
381
389
|
parser.add_argument(
|
|
382
390
|
'user',
|
|
@@ -385,7 +393,9 @@ class ShowUser(command.ShowOne):
|
|
|
385
393
|
)
|
|
386
394
|
return parser
|
|
387
395
|
|
|
388
|
-
def take_action(
|
|
396
|
+
def take_action(
|
|
397
|
+
self, parsed_args: argparse.Namespace
|
|
398
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
389
399
|
identity_client = self.app.client_manager.identity
|
|
390
400
|
|
|
391
401
|
info = {}
|
|
@@ -417,4 +427,5 @@ class ShowUser(command.ShowOne):
|
|
|
417
427
|
if 'tenant_id' in info:
|
|
418
428
|
info.update({'project_id': info.pop('tenant_id')})
|
|
419
429
|
|
|
420
|
-
|
|
430
|
+
col_headers, col_data = zip(*sorted(info.items()))
|
|
431
|
+
return col_headers, col_data
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v3 Access Rule action implementations"""
|
|
17
17
|
|
|
18
|
+
import argparse
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
18
20
|
import logging
|
|
21
|
+
from typing import Any
|
|
19
22
|
|
|
23
|
+
from openstack import utils as sdk_utils
|
|
20
24
|
from osc_lib import exceptions
|
|
21
25
|
from osc_lib import utils
|
|
22
26
|
|
|
@@ -31,7 +35,7 @@ LOG = logging.getLogger(__name__)
|
|
|
31
35
|
class DeleteAccessRule(command.Command):
|
|
32
36
|
_description = _("Delete access rule(s)")
|
|
33
37
|
|
|
34
|
-
def get_parser(self, prog_name):
|
|
38
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
35
39
|
parser = super().get_parser(prog_name)
|
|
36
40
|
parser.add_argument(
|
|
37
41
|
'access_rule',
|
|
@@ -41,14 +45,16 @@ class DeleteAccessRule(command.Command):
|
|
|
41
45
|
)
|
|
42
46
|
return parser
|
|
43
47
|
|
|
44
|
-
def take_action(self, parsed_args):
|
|
45
|
-
identity_client =
|
|
48
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
49
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
50
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
51
|
+
)
|
|
46
52
|
conn = self.app.client_manager.sdk_connection
|
|
47
53
|
auth = conn.config.get_auth()
|
|
48
54
|
if auth is None:
|
|
49
55
|
# this will never happen
|
|
50
56
|
raise exceptions.CommandError('invalid authentication info')
|
|
51
|
-
user_id = auth.get_user_id(conn.
|
|
57
|
+
user_id = auth.get_user_id(conn.session)
|
|
52
58
|
|
|
53
59
|
errors = 0
|
|
54
60
|
for ac in parsed_args.access_rule:
|
|
@@ -73,7 +79,7 @@ class DeleteAccessRule(command.Command):
|
|
|
73
79
|
class ListAccessRule(command.Lister):
|
|
74
80
|
_description = _("List access rules")
|
|
75
81
|
|
|
76
|
-
def get_parser(self, prog_name):
|
|
82
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
77
83
|
parser = super().get_parser(prog_name)
|
|
78
84
|
parser.add_argument(
|
|
79
85
|
'--user',
|
|
@@ -83,8 +89,12 @@ class ListAccessRule(command.Lister):
|
|
|
83
89
|
common.add_user_domain_option_to_parser(parser)
|
|
84
90
|
return parser
|
|
85
91
|
|
|
86
|
-
def take_action(
|
|
87
|
-
|
|
92
|
+
def take_action(
|
|
93
|
+
self, parsed_args: argparse.Namespace
|
|
94
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
95
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
96
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
97
|
+
)
|
|
88
98
|
if parsed_args.user:
|
|
89
99
|
user_id = common.find_user(
|
|
90
100
|
identity_client, parsed_args.user, parsed_args.user_domain
|
|
@@ -95,7 +105,7 @@ class ListAccessRule(command.Lister):
|
|
|
95
105
|
if auth is None:
|
|
96
106
|
# this will never happen
|
|
97
107
|
raise exceptions.CommandError('invalid authentication info')
|
|
98
|
-
user_id = auth.get_user_id(conn.
|
|
108
|
+
user_id = auth.get_user_id(conn.session)
|
|
99
109
|
|
|
100
110
|
columns = ('ID', 'Service', 'Method', 'Path')
|
|
101
111
|
data = identity_client.access_rules(user=user_id)
|
|
@@ -115,7 +125,7 @@ class ListAccessRule(command.Lister):
|
|
|
115
125
|
class ShowAccessRule(command.ShowOne):
|
|
116
126
|
_description = _("Display access rule details")
|
|
117
127
|
|
|
118
|
-
def get_parser(self, prog_name):
|
|
128
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
119
129
|
parser = super().get_parser(prog_name)
|
|
120
130
|
parser.add_argument(
|
|
121
131
|
'access_rule',
|
|
@@ -124,14 +134,18 @@ class ShowAccessRule(command.ShowOne):
|
|
|
124
134
|
)
|
|
125
135
|
return parser
|
|
126
136
|
|
|
127
|
-
def take_action(
|
|
128
|
-
|
|
137
|
+
def take_action(
|
|
138
|
+
self, parsed_args: argparse.Namespace
|
|
139
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
140
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
141
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
142
|
+
)
|
|
129
143
|
conn = self.app.client_manager.sdk_connection
|
|
130
144
|
auth = conn.config.get_auth()
|
|
131
145
|
if auth is None:
|
|
132
146
|
# this will never happen
|
|
133
147
|
raise exceptions.CommandError('invalid authentication info')
|
|
134
|
-
user_id = auth.get_user_id(conn.
|
|
148
|
+
user_id = auth.get_user_id(conn.session)
|
|
135
149
|
|
|
136
150
|
access_rule = identity_client.get_access_rule(
|
|
137
151
|
user_id, parsed_args.access_rule
|
|
@@ -15,13 +15,16 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v3 Application Credential action implementations"""
|
|
17
17
|
|
|
18
|
+
import argparse
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
18
20
|
import datetime
|
|
19
21
|
import json
|
|
20
22
|
import logging
|
|
21
|
-
|
|
23
|
+
from typing import Any
|
|
22
24
|
import uuid
|
|
23
25
|
|
|
24
26
|
from cliff import columns as cliff_columns
|
|
27
|
+
from openstack import utils as sdk_utils
|
|
25
28
|
from osc_lib import exceptions
|
|
26
29
|
from osc_lib import utils
|
|
27
30
|
|
|
@@ -32,16 +35,16 @@ from openstackclient.identity import common
|
|
|
32
35
|
LOG = logging.getLogger(__name__)
|
|
33
36
|
|
|
34
37
|
|
|
35
|
-
class RolesColumn(cliff_columns.FormattableColumn[
|
|
38
|
+
class RolesColumn(cliff_columns.FormattableColumn[Any]):
|
|
36
39
|
"""Generate a formatted string of role names."""
|
|
37
40
|
|
|
38
|
-
def human_readable(self):
|
|
39
|
-
return utils.format_list(list(r['name'] for r in self._value))
|
|
41
|
+
def human_readable(self) -> str:
|
|
42
|
+
return utils.format_list(list(r['name'] for r in self._value)) or ""
|
|
40
43
|
|
|
41
44
|
|
|
42
45
|
def _format_application_credential(
|
|
43
|
-
application_credential, *, include_secret=False
|
|
44
|
-
):
|
|
46
|
+
application_credential: Any, *, include_secret: bool = False
|
|
47
|
+
) -> tuple[tuple[str, ...], Any]:
|
|
45
48
|
column_headers: tuple[str, ...] = (
|
|
46
49
|
'ID',
|
|
47
50
|
'Name',
|
|
@@ -74,7 +77,9 @@ def _format_application_credential(
|
|
|
74
77
|
)
|
|
75
78
|
|
|
76
79
|
|
|
77
|
-
def _format_application_credentials(
|
|
80
|
+
def _format_application_credentials(
|
|
81
|
+
application_credentials: Any,
|
|
82
|
+
) -> tuple[tuple[str, ...], Any]:
|
|
78
83
|
column_headers = (
|
|
79
84
|
'ID',
|
|
80
85
|
'Name',
|
|
@@ -108,7 +113,7 @@ def _format_application_credentials(application_credentials):
|
|
|
108
113
|
|
|
109
114
|
|
|
110
115
|
# TODO(stephenfin): Move this to osc_lib since it's useful elsewhere
|
|
111
|
-
def is_uuid_like(value) -> bool:
|
|
116
|
+
def is_uuid_like(value: str) -> bool:
|
|
112
117
|
"""Returns validation of a value as a UUID.
|
|
113
118
|
|
|
114
119
|
:param val: Value to verify
|
|
@@ -131,7 +136,7 @@ def is_uuid_like(value) -> bool:
|
|
|
131
136
|
class CreateApplicationCredential(command.ShowOne):
|
|
132
137
|
_description = _("Create new application credential")
|
|
133
138
|
|
|
134
|
-
def get_parser(self, prog_name):
|
|
139
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
135
140
|
parser = super().get_parser(prog_name)
|
|
136
141
|
parser.add_argument(
|
|
137
142
|
'name',
|
|
@@ -203,15 +208,22 @@ class CreateApplicationCredential(command.ShowOne):
|
|
|
203
208
|
)
|
|
204
209
|
return parser
|
|
205
210
|
|
|
206
|
-
def take_action(
|
|
207
|
-
|
|
211
|
+
def take_action(
|
|
212
|
+
self, parsed_args: argparse.Namespace
|
|
213
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
214
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
215
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
216
|
+
)
|
|
208
217
|
conn = self.app.client_manager.sdk_connection
|
|
209
218
|
auth = conn.config.get_auth()
|
|
210
219
|
if auth is None:
|
|
211
220
|
# this will never happen
|
|
212
221
|
raise exceptions.CommandError('invalid authentication info')
|
|
213
222
|
|
|
214
|
-
user_id = auth.get_user_id(conn.
|
|
223
|
+
user_id = auth.get_user_id(conn.session)
|
|
224
|
+
if user_id is None:
|
|
225
|
+
msg = _("failed to retrieve auth info for current session")
|
|
226
|
+
raise exceptions.CommandError(msg)
|
|
215
227
|
|
|
216
228
|
role_ids = []
|
|
217
229
|
for role in parsed_args.roles:
|
|
@@ -266,7 +278,7 @@ class CreateApplicationCredential(command.ShowOne):
|
|
|
266
278
|
class DeleteApplicationCredential(command.Command):
|
|
267
279
|
_description = _("Delete application credentials(s)")
|
|
268
280
|
|
|
269
|
-
def get_parser(self, prog_name):
|
|
281
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
270
282
|
parser = super().get_parser(prog_name)
|
|
271
283
|
parser.add_argument(
|
|
272
284
|
'application_credential',
|
|
@@ -276,15 +288,21 @@ class DeleteApplicationCredential(command.Command):
|
|
|
276
288
|
)
|
|
277
289
|
return parser
|
|
278
290
|
|
|
279
|
-
def take_action(self, parsed_args):
|
|
280
|
-
identity_client =
|
|
291
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
292
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
293
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
294
|
+
)
|
|
295
|
+
|
|
281
296
|
conn = self.app.client_manager.sdk_connection
|
|
282
297
|
auth = conn.config.get_auth()
|
|
283
298
|
if auth is None:
|
|
284
299
|
# this will never happen
|
|
285
300
|
raise exceptions.CommandError('invalid authentication info')
|
|
286
301
|
|
|
287
|
-
user_id = auth.get_user_id(conn.
|
|
302
|
+
user_id = auth.get_user_id(conn.session)
|
|
303
|
+
if user_id is None:
|
|
304
|
+
msg = _("failed to retrieve auth info for current session")
|
|
305
|
+
raise exceptions.CommandError(msg)
|
|
288
306
|
|
|
289
307
|
errors = 0
|
|
290
308
|
for ac in parsed_args.application_credential:
|
|
@@ -319,7 +337,7 @@ class DeleteApplicationCredential(command.Command):
|
|
|
319
337
|
class ListApplicationCredential(command.Lister):
|
|
320
338
|
_description = _("List application credentials")
|
|
321
339
|
|
|
322
|
-
def get_parser(self, prog_name):
|
|
340
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
323
341
|
parser = super().get_parser(prog_name)
|
|
324
342
|
parser.add_argument(
|
|
325
343
|
'--user',
|
|
@@ -329,8 +347,12 @@ class ListApplicationCredential(command.Lister):
|
|
|
329
347
|
common.add_user_domain_option_to_parser(parser)
|
|
330
348
|
return parser
|
|
331
349
|
|
|
332
|
-
def take_action(
|
|
333
|
-
|
|
350
|
+
def take_action(
|
|
351
|
+
self, parsed_args: argparse.Namespace
|
|
352
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
353
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
354
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
355
|
+
)
|
|
334
356
|
if parsed_args.user:
|
|
335
357
|
user_id = common.find_user_id_sdk(
|
|
336
358
|
identity_client, parsed_args.user, parsed_args.user_domain
|
|
@@ -341,7 +363,11 @@ class ListApplicationCredential(command.Lister):
|
|
|
341
363
|
if auth is None:
|
|
342
364
|
# this will never happen
|
|
343
365
|
raise exceptions.CommandError('invalid authentication info')
|
|
344
|
-
|
|
366
|
+
_user_id = auth.get_user_id(conn.session)
|
|
367
|
+
if _user_id is None:
|
|
368
|
+
# this will never happen
|
|
369
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
370
|
+
user_id = _user_id
|
|
345
371
|
|
|
346
372
|
application_credentials = identity_client.application_credentials(
|
|
347
373
|
user=user_id
|
|
@@ -353,7 +379,7 @@ class ListApplicationCredential(command.Lister):
|
|
|
353
379
|
class ShowApplicationCredential(command.ShowOne):
|
|
354
380
|
_description = _("Display application credential details")
|
|
355
381
|
|
|
356
|
-
def get_parser(self, prog_name):
|
|
382
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
357
383
|
parser = super().get_parser(prog_name)
|
|
358
384
|
parser.add_argument(
|
|
359
385
|
'application_credential',
|
|
@@ -362,14 +388,23 @@ class ShowApplicationCredential(command.ShowOne):
|
|
|
362
388
|
)
|
|
363
389
|
return parser
|
|
364
390
|
|
|
365
|
-
def take_action(
|
|
366
|
-
|
|
391
|
+
def take_action(
|
|
392
|
+
self, parsed_args: argparse.Namespace
|
|
393
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
394
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
395
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
396
|
+
)
|
|
397
|
+
|
|
367
398
|
conn = self.app.client_manager.sdk_connection
|
|
368
399
|
auth = conn.config.get_auth()
|
|
369
400
|
if auth is None:
|
|
370
401
|
# this will never happen
|
|
371
402
|
raise exceptions.CommandError('invalid authentication info')
|
|
372
|
-
|
|
403
|
+
|
|
404
|
+
user_id = auth.get_user_id(conn.session)
|
|
405
|
+
if user_id is None:
|
|
406
|
+
msg = _("failed to retrieve auth info for current session")
|
|
407
|
+
raise exceptions.CommandError(msg)
|
|
373
408
|
|
|
374
409
|
application_credential = identity_client.find_application_credential(
|
|
375
410
|
user_id, parsed_args.application_credential, ignore_missing=False
|
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
"""Identity v3 Service Catalog action implementations"""
|
|
14
14
|
|
|
15
|
+
import argparse
|
|
16
|
+
from collections.abc import Iterable, Sequence
|
|
15
17
|
import logging
|
|
16
|
-
|
|
18
|
+
from typing import Any
|
|
17
19
|
|
|
18
20
|
from cliff import columns as cliff_columns
|
|
19
21
|
from osc_lib import exceptions
|
|
@@ -26,8 +28,8 @@ from openstackclient.i18n import _
|
|
|
26
28
|
LOG = logging.getLogger(__name__)
|
|
27
29
|
|
|
28
30
|
|
|
29
|
-
class EndpointsColumn(cliff_columns.FormattableColumn[
|
|
30
|
-
def human_readable(self):
|
|
31
|
+
class EndpointsColumn(cliff_columns.FormattableColumn[Any]):
|
|
32
|
+
def human_readable(self) -> str:
|
|
31
33
|
if not self._value:
|
|
32
34
|
return ""
|
|
33
35
|
ret = ''
|
|
@@ -41,7 +43,9 @@ class EndpointsColumn(cliff_columns.FormattableColumn[ty.Any]):
|
|
|
41
43
|
class ListCatalog(command.Lister):
|
|
42
44
|
_description = _("List services in the service catalog")
|
|
43
45
|
|
|
44
|
-
def take_action(
|
|
46
|
+
def take_action(
|
|
47
|
+
self, parsed_args: argparse.Namespace
|
|
48
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
45
49
|
# Trigger auth if it has not happened yet
|
|
46
50
|
auth_ref = self.app.client_manager.auth_ref
|
|
47
51
|
if not auth_ref:
|
|
@@ -69,7 +73,7 @@ class ListCatalog(command.Lister):
|
|
|
69
73
|
class ShowCatalog(command.ShowOne):
|
|
70
74
|
_description = _("Display service catalog details")
|
|
71
75
|
|
|
72
|
-
def get_parser(self, prog_name):
|
|
76
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
73
77
|
parser = super().get_parser(prog_name)
|
|
74
78
|
parser.add_argument(
|
|
75
79
|
'service',
|
|
@@ -78,7 +82,9 @@ class ShowCatalog(command.ShowOne):
|
|
|
78
82
|
)
|
|
79
83
|
return parser
|
|
80
84
|
|
|
81
|
-
def take_action(
|
|
85
|
+
def take_action(
|
|
86
|
+
self, parsed_args: argparse.Namespace
|
|
87
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
82
88
|
# Trigger auth if it has not happened yet
|
|
83
89
|
auth_ref = self.app.client_manager.auth_ref
|
|
84
90
|
if not auth_ref:
|
|
@@ -102,4 +108,5 @@ class ShowCatalog(command.ShowOne):
|
|
|
102
108
|
LOG.error(_('service %s not found\n'), parsed_args.service)
|
|
103
109
|
return ((), ())
|
|
104
110
|
|
|
105
|
-
|
|
111
|
+
col_headers, col_data = zip(*sorted(data.items()))
|
|
112
|
+
return col_headers, col_data
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v3 Consumer action implementations"""
|
|
17
17
|
|
|
18
|
+
import argparse
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
18
20
|
import logging
|
|
21
|
+
from typing import Any
|
|
19
22
|
|
|
20
23
|
from osc_lib import exceptions
|
|
21
24
|
from osc_lib import utils
|
|
@@ -30,7 +33,7 @@ LOG = logging.getLogger(__name__)
|
|
|
30
33
|
class CreateConsumer(command.ShowOne):
|
|
31
34
|
_description = _("Create new consumer")
|
|
32
35
|
|
|
33
|
-
def get_parser(self, prog_name):
|
|
36
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
34
37
|
parser = super().get_parser(prog_name)
|
|
35
38
|
parser.add_argument(
|
|
36
39
|
'--description',
|
|
@@ -39,19 +42,22 @@ class CreateConsumer(command.ShowOne):
|
|
|
39
42
|
)
|
|
40
43
|
return parser
|
|
41
44
|
|
|
42
|
-
def take_action(
|
|
45
|
+
def take_action(
|
|
46
|
+
self, parsed_args: argparse.Namespace
|
|
47
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
43
48
|
identity_client = self.app.client_manager.identity
|
|
44
49
|
consumer = identity_client.oauth1.consumers.create(
|
|
45
50
|
parsed_args.description
|
|
46
51
|
)
|
|
47
52
|
consumer._info.pop('links', None)
|
|
48
|
-
|
|
53
|
+
col_headers, col_data = zip(*sorted(consumer._info.items()))
|
|
54
|
+
return col_headers, col_data
|
|
49
55
|
|
|
50
56
|
|
|
51
57
|
class DeleteConsumer(command.Command):
|
|
52
58
|
_description = _("Delete consumer(s)")
|
|
53
59
|
|
|
54
|
-
def get_parser(self, prog_name):
|
|
60
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
55
61
|
parser = super().get_parser(prog_name)
|
|
56
62
|
parser.add_argument(
|
|
57
63
|
'consumer',
|
|
@@ -61,7 +67,7 @@ class DeleteConsumer(command.Command):
|
|
|
61
67
|
)
|
|
62
68
|
return parser
|
|
63
69
|
|
|
64
|
-
def take_action(self, parsed_args):
|
|
70
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
65
71
|
identity_client = self.app.client_manager.identity
|
|
66
72
|
result = 0
|
|
67
73
|
for i in parsed_args.consumer:
|
|
@@ -92,7 +98,9 @@ class DeleteConsumer(command.Command):
|
|
|
92
98
|
class ListConsumer(command.Lister):
|
|
93
99
|
_description = _("List consumers")
|
|
94
100
|
|
|
95
|
-
def take_action(
|
|
101
|
+
def take_action(
|
|
102
|
+
self, parsed_args: argparse.Namespace
|
|
103
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
96
104
|
columns = ('ID', 'Description')
|
|
97
105
|
data = self.app.client_manager.identity.oauth1.consumers.list()
|
|
98
106
|
return (
|
|
@@ -111,7 +119,7 @@ class ListConsumer(command.Lister):
|
|
|
111
119
|
class SetConsumer(command.Command):
|
|
112
120
|
_description = _("Set consumer properties")
|
|
113
121
|
|
|
114
|
-
def get_parser(self, prog_name):
|
|
122
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
115
123
|
parser = super().get_parser(prog_name)
|
|
116
124
|
parser.add_argument(
|
|
117
125
|
'consumer',
|
|
@@ -125,7 +133,7 @@ class SetConsumer(command.Command):
|
|
|
125
133
|
)
|
|
126
134
|
return parser
|
|
127
135
|
|
|
128
|
-
def take_action(self, parsed_args):
|
|
136
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
129
137
|
identity_client = self.app.client_manager.identity
|
|
130
138
|
consumer = utils.find_resource(
|
|
131
139
|
identity_client.oauth1.consumers, parsed_args.consumer
|
|
@@ -142,7 +150,7 @@ class SetConsumer(command.Command):
|
|
|
142
150
|
class ShowConsumer(command.ShowOne):
|
|
143
151
|
_description = _("Display consumer details")
|
|
144
152
|
|
|
145
|
-
def get_parser(self, prog_name):
|
|
153
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
146
154
|
parser = super().get_parser(prog_name)
|
|
147
155
|
parser.add_argument(
|
|
148
156
|
'consumer',
|
|
@@ -151,11 +159,14 @@ class ShowConsumer(command.ShowOne):
|
|
|
151
159
|
)
|
|
152
160
|
return parser
|
|
153
161
|
|
|
154
|
-
def take_action(
|
|
162
|
+
def take_action(
|
|
163
|
+
self, parsed_args: argparse.Namespace
|
|
164
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
155
165
|
identity_client = self.app.client_manager.identity
|
|
156
166
|
consumer = utils.find_resource(
|
|
157
167
|
identity_client.oauth1.consumers, parsed_args.consumer
|
|
158
168
|
)
|
|
159
169
|
|
|
160
170
|
consumer._info.pop('links', None)
|
|
161
|
-
|
|
171
|
+
col_headers, col_data = zip(*sorted(consumer._info.items()))
|
|
172
|
+
return col_headers, col_data
|