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
|
@@ -13,8 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
"""Identity v3 IdentityProvider action implementations"""
|
|
15
15
|
|
|
16
|
+
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
16
18
|
import logging
|
|
19
|
+
from typing import Any
|
|
17
20
|
|
|
21
|
+
from openstack import utils as sdk_utils
|
|
18
22
|
from osc_lib.cli import format_columns
|
|
19
23
|
from osc_lib import exceptions
|
|
20
24
|
from osc_lib import utils
|
|
@@ -27,10 +31,35 @@ from openstackclient.identity import common
|
|
|
27
31
|
LOG = logging.getLogger(__name__)
|
|
28
32
|
|
|
29
33
|
|
|
34
|
+
def _format_identity_provider(idp):
|
|
35
|
+
columns = (
|
|
36
|
+
'authorization_ttl',
|
|
37
|
+
'description',
|
|
38
|
+
'domain_id',
|
|
39
|
+
'is_enabled',
|
|
40
|
+
'name',
|
|
41
|
+
'remote_ids',
|
|
42
|
+
)
|
|
43
|
+
column_headers = (
|
|
44
|
+
'authorization_ttl',
|
|
45
|
+
'description',
|
|
46
|
+
'domain_id',
|
|
47
|
+
'enabled',
|
|
48
|
+
'id',
|
|
49
|
+
'remote_ids',
|
|
50
|
+
)
|
|
51
|
+
return (
|
|
52
|
+
column_headers,
|
|
53
|
+
utils.get_item_properties(
|
|
54
|
+
idp, columns, formatters={'remote_ids': format_columns.ListColumn}
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
30
59
|
class CreateIdentityProvider(command.ShowOne):
|
|
31
60
|
_description = _("Create new identity provider")
|
|
32
61
|
|
|
33
|
-
def get_parser(self, prog_name):
|
|
62
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
34
63
|
parser = super().get_parser(prog_name)
|
|
35
64
|
parser.add_argument(
|
|
36
65
|
'identity_provider_id',
|
|
@@ -98,26 +127,34 @@ class CreateIdentityProvider(command.ShowOne):
|
|
|
98
127
|
)
|
|
99
128
|
return parser
|
|
100
129
|
|
|
101
|
-
def take_action(
|
|
102
|
-
|
|
103
|
-
|
|
130
|
+
def take_action(
|
|
131
|
+
self, parsed_args: argparse.Namespace
|
|
132
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
133
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
134
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
135
|
+
)
|
|
136
|
+
kwargs = {'is_enabled': parsed_args.enabled}
|
|
137
|
+
if parsed_args.identity_provider_id:
|
|
138
|
+
kwargs['id'] = parsed_args.identity_provider_id
|
|
139
|
+
if parsed_args.description:
|
|
140
|
+
kwargs['description'] = parsed_args.description
|
|
141
|
+
|
|
104
142
|
if parsed_args.remote_id_file:
|
|
105
143
|
file_content = utils.read_blob_file_contents(
|
|
106
144
|
parsed_args.remote_id_file
|
|
107
145
|
)
|
|
108
146
|
remote_ids = file_content.splitlines()
|
|
109
|
-
remote_ids = list(map(str.strip, remote_ids))
|
|
147
|
+
kwargs['remote_ids'] = list(map(str.strip, remote_ids))
|
|
110
148
|
elif parsed_args.remote_ids:
|
|
111
|
-
remote_ids = parsed_args.remote_ids
|
|
149
|
+
kwargs['remote_ids'] = parsed_args.remote_ids
|
|
112
150
|
|
|
113
|
-
domain_id = None
|
|
114
151
|
if parsed_args.domain:
|
|
115
|
-
domain_id = common.
|
|
116
|
-
identity_client,
|
|
117
|
-
|
|
152
|
+
kwargs['domain_id'] = common.find_domain_id_sdk(
|
|
153
|
+
identity_client,
|
|
154
|
+
parsed_args.domain,
|
|
155
|
+
validate_actor_existence=False,
|
|
156
|
+
)
|
|
118
157
|
|
|
119
|
-
# TODO(pas-ha) actually check for 3.14 microversion
|
|
120
|
-
kwargs = {}
|
|
121
158
|
auth_ttl = parsed_args.authorization_ttl
|
|
122
159
|
if auth_ttl is not None:
|
|
123
160
|
if auth_ttl < 0:
|
|
@@ -127,26 +164,15 @@ class CreateIdentityProvider(command.ShowOne):
|
|
|
127
164
|
raise exceptions.CommandError(msg)
|
|
128
165
|
kwargs['authorization_ttl'] = auth_ttl
|
|
129
166
|
|
|
130
|
-
idp = identity_client.
|
|
131
|
-
id=parsed_args.identity_provider_id,
|
|
132
|
-
remote_ids=remote_ids,
|
|
133
|
-
description=parsed_args.description,
|
|
134
|
-
domain_id=domain_id,
|
|
135
|
-
enabled=parsed_args.enabled,
|
|
136
|
-
**kwargs,
|
|
137
|
-
)
|
|
167
|
+
idp = identity_client.create_identity_provider(**kwargs)
|
|
138
168
|
|
|
139
|
-
idp
|
|
140
|
-
idp._info['remote_ids'] = format_columns.ListColumn(
|
|
141
|
-
idp._info.pop('remote_ids', [])
|
|
142
|
-
)
|
|
143
|
-
return zip(*sorted(idp._info.items()))
|
|
169
|
+
return _format_identity_provider(idp)
|
|
144
170
|
|
|
145
171
|
|
|
146
172
|
class DeleteIdentityProvider(command.Command):
|
|
147
173
|
_description = _("Delete identity provider(s)")
|
|
148
174
|
|
|
149
|
-
def get_parser(self, prog_name):
|
|
175
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
150
176
|
parser = super().get_parser(prog_name)
|
|
151
177
|
parser.add_argument(
|
|
152
178
|
'identity_provider',
|
|
@@ -156,17 +182,19 @@ class DeleteIdentityProvider(command.Command):
|
|
|
156
182
|
)
|
|
157
183
|
return parser
|
|
158
184
|
|
|
159
|
-
def take_action(self, parsed_args):
|
|
160
|
-
identity_client =
|
|
185
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
186
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
187
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
188
|
+
)
|
|
161
189
|
result = 0
|
|
162
190
|
for i in parsed_args.identity_provider:
|
|
163
191
|
try:
|
|
164
|
-
identity_client.
|
|
192
|
+
identity_client.delete_identity_provider(i)
|
|
165
193
|
except Exception as e:
|
|
166
194
|
result += 1
|
|
167
195
|
LOG.error(
|
|
168
196
|
_(
|
|
169
|
-
"Failed to delete identity
|
|
197
|
+
"Failed to delete identity provider with "
|
|
170
198
|
"name or ID '%(provider)s': %(e)s"
|
|
171
199
|
),
|
|
172
200
|
{'provider': i, 'e': e},
|
|
@@ -183,34 +211,39 @@ class DeleteIdentityProvider(command.Command):
|
|
|
183
211
|
class ListIdentityProvider(command.Lister):
|
|
184
212
|
_description = _("List identity providers")
|
|
185
213
|
|
|
186
|
-
def get_parser(self, prog_name):
|
|
214
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
187
215
|
parser = super().get_parser(prog_name)
|
|
188
216
|
parser.add_argument(
|
|
189
217
|
'--id',
|
|
190
218
|
metavar='<id>',
|
|
191
|
-
help=_('
|
|
219
|
+
help=_('Filter identity providers by ID'),
|
|
192
220
|
)
|
|
193
221
|
parser.add_argument(
|
|
194
222
|
'--enabled',
|
|
195
223
|
dest='enabled',
|
|
196
224
|
action='store_true',
|
|
197
|
-
help=_('
|
|
225
|
+
help=_('List only enabled identity providers'),
|
|
198
226
|
)
|
|
199
227
|
return parser
|
|
200
228
|
|
|
201
|
-
def take_action(
|
|
202
|
-
|
|
203
|
-
|
|
229
|
+
def take_action(
|
|
230
|
+
self, parsed_args: argparse.Namespace
|
|
231
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
232
|
+
columns = ('id', 'is_enabled', 'domain_id', 'description')
|
|
233
|
+
column_headers = ('ID', 'Enabled', 'Domain ID', 'Description')
|
|
234
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
235
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
236
|
+
)
|
|
204
237
|
|
|
205
238
|
kwargs = {}
|
|
206
239
|
if parsed_args.id:
|
|
207
240
|
kwargs['id'] = parsed_args.id
|
|
208
241
|
if parsed_args.enabled:
|
|
209
|
-
kwargs['
|
|
242
|
+
kwargs['is_enabled'] = True
|
|
210
243
|
|
|
211
|
-
data = identity_client.
|
|
244
|
+
data = identity_client.identity_providers(**kwargs)
|
|
212
245
|
return (
|
|
213
|
-
|
|
246
|
+
column_headers,
|
|
214
247
|
(
|
|
215
248
|
utils.get_item_properties(
|
|
216
249
|
s,
|
|
@@ -225,7 +258,7 @@ class ListIdentityProvider(command.Lister):
|
|
|
225
258
|
class SetIdentityProvider(command.Command):
|
|
226
259
|
_description = _("Set identity provider properties")
|
|
227
260
|
|
|
228
|
-
def get_parser(self, prog_name):
|
|
261
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
229
262
|
parser = super().get_parser(prog_name)
|
|
230
263
|
parser.add_argument(
|
|
231
264
|
'identity_provider',
|
|
@@ -279,8 +312,10 @@ class SetIdentityProvider(command.Command):
|
|
|
279
312
|
)
|
|
280
313
|
return parser
|
|
281
314
|
|
|
282
|
-
def take_action(self, parsed_args):
|
|
283
|
-
|
|
315
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
316
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
317
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
318
|
+
)
|
|
284
319
|
|
|
285
320
|
# Always set remote_ids if either is passed in
|
|
286
321
|
if parsed_args.remote_id_file:
|
|
@@ -297,13 +332,14 @@ class SetIdentityProvider(command.Command):
|
|
|
297
332
|
if parsed_args.description:
|
|
298
333
|
kwargs['description'] = parsed_args.description
|
|
299
334
|
if parsed_args.enable:
|
|
300
|
-
kwargs['
|
|
335
|
+
kwargs['is_enabled'] = True
|
|
301
336
|
if parsed_args.disable:
|
|
302
|
-
kwargs['
|
|
337
|
+
kwargs['is_enabled'] = False
|
|
303
338
|
if parsed_args.remote_id_file or parsed_args.remote_ids:
|
|
304
339
|
kwargs['remote_ids'] = remote_ids
|
|
305
340
|
|
|
306
|
-
#
|
|
341
|
+
# NOTE(0weng): This is now possible in SDK! An option should be added.
|
|
342
|
+
# Original comment:
|
|
307
343
|
# TODO(pas-ha) make it possible to reset authorization_ttl
|
|
308
344
|
# back to None value.
|
|
309
345
|
# Currently not possible as filter_kwargs decorator in
|
|
@@ -318,7 +354,7 @@ class SetIdentityProvider(command.Command):
|
|
|
318
354
|
raise exceptions.CommandError(msg)
|
|
319
355
|
kwargs['authorization_ttl'] = auth_ttl
|
|
320
356
|
|
|
321
|
-
|
|
357
|
+
identity_client.update_identity_provider(
|
|
322
358
|
parsed_args.identity_provider, **kwargs
|
|
323
359
|
)
|
|
324
360
|
|
|
@@ -326,7 +362,7 @@ class SetIdentityProvider(command.Command):
|
|
|
326
362
|
class ShowIdentityProvider(command.ShowOne):
|
|
327
363
|
_description = _("Display identity provider details")
|
|
328
364
|
|
|
329
|
-
def get_parser(self, prog_name):
|
|
365
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
330
366
|
parser = super().get_parser(prog_name)
|
|
331
367
|
parser.add_argument(
|
|
332
368
|
'identity_provider',
|
|
@@ -335,15 +371,14 @@ class ShowIdentityProvider(command.ShowOne):
|
|
|
335
371
|
)
|
|
336
372
|
return parser
|
|
337
373
|
|
|
338
|
-
def take_action(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
374
|
+
def take_action(
|
|
375
|
+
self, parsed_args: argparse.Namespace
|
|
376
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
377
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
378
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
379
|
+
)
|
|
380
|
+
idp = identity_client.get_identity_provider(
|
|
381
|
+
parsed_args.identity_provider
|
|
344
382
|
)
|
|
345
383
|
|
|
346
|
-
idp
|
|
347
|
-
remote_ids = format_columns.ListColumn(idp._info.pop('remote_ids', []))
|
|
348
|
-
idp._info['remote_ids'] = remote_ids
|
|
349
|
-
return zip(*sorted(idp._info.items()))
|
|
384
|
+
return _format_identity_provider(idp)
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v3 Implied Role 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
|
|
|
21
24
|
from openstackclient import command
|
|
@@ -25,7 +28,9 @@ from openstackclient.i18n import _
|
|
|
25
28
|
LOG = logging.getLogger(__name__)
|
|
26
29
|
|
|
27
30
|
|
|
28
|
-
def _get_role_ids(
|
|
31
|
+
def _get_role_ids(
|
|
32
|
+
identity_client: Any, parsed_args: argparse.Namespace
|
|
33
|
+
) -> tuple[Any, Any]:
|
|
29
34
|
"""Return prior and implied role id(s)
|
|
30
35
|
|
|
31
36
|
If prior and implied role id(s) are retrievable from identity
|
|
@@ -50,7 +55,7 @@ def _get_role_ids(identity_client, parsed_args):
|
|
|
50
55
|
class CreateImpliedRole(command.ShowOne):
|
|
51
56
|
_description = _("Creates an association between prior and implied roles")
|
|
52
57
|
|
|
53
|
-
def get_parser(self, prog_name):
|
|
58
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
54
59
|
parser = super().get_parser(prog_name)
|
|
55
60
|
parser.add_argument(
|
|
56
61
|
'role',
|
|
@@ -65,7 +70,9 @@ class CreateImpliedRole(command.ShowOne):
|
|
|
65
70
|
)
|
|
66
71
|
return parser
|
|
67
72
|
|
|
68
|
-
def take_action(
|
|
73
|
+
def take_action(
|
|
74
|
+
self, parsed_args: argparse.Namespace
|
|
75
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
69
76
|
identity_client = self.app.client_manager.identity
|
|
70
77
|
(prior_role_id, implied_role_id) = _get_role_ids(
|
|
71
78
|
identity_client, parsed_args
|
|
@@ -74,13 +81,16 @@ class CreateImpliedRole(command.ShowOne):
|
|
|
74
81
|
prior_role_id, implied_role_id
|
|
75
82
|
)
|
|
76
83
|
response._info.pop('links', None)
|
|
77
|
-
|
|
84
|
+
col_headers, col_data = zip(
|
|
85
|
+
*sorted([(k, v['id']) for k, v in response._info.items()])
|
|
86
|
+
)
|
|
87
|
+
return col_headers, col_data
|
|
78
88
|
|
|
79
89
|
|
|
80
90
|
class DeleteImpliedRole(command.Command):
|
|
81
91
|
_description = _("Deletes an association between prior and implied roles")
|
|
82
92
|
|
|
83
|
-
def get_parser(self, prog_name):
|
|
93
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
84
94
|
parser = super().get_parser(prog_name)
|
|
85
95
|
parser.add_argument(
|
|
86
96
|
'role',
|
|
@@ -95,7 +105,7 @@ class DeleteImpliedRole(command.Command):
|
|
|
95
105
|
)
|
|
96
106
|
return parser
|
|
97
107
|
|
|
98
|
-
def take_action(self, parsed_args):
|
|
108
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
99
109
|
identity_client = self.app.client_manager.identity
|
|
100
110
|
(prior_role_id, implied_role_id) = _get_role_ids(
|
|
101
111
|
identity_client, parsed_args
|
|
@@ -112,12 +122,14 @@ class ListImpliedRole(command.Lister):
|
|
|
112
122
|
'Implied Role Name',
|
|
113
123
|
]
|
|
114
124
|
|
|
115
|
-
def get_parser(self, prog_name):
|
|
125
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
116
126
|
parser = super().get_parser(prog_name)
|
|
117
127
|
return parser
|
|
118
128
|
|
|
119
|
-
def take_action(
|
|
120
|
-
|
|
129
|
+
def take_action(
|
|
130
|
+
self, parsed_args: argparse.Namespace
|
|
131
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
132
|
+
def _list_implied(response: Any) -> Iterable[tuple[Any, ...]]:
|
|
121
133
|
for rule in response:
|
|
122
134
|
for implies in rule.implies:
|
|
123
135
|
yield (
|
|
@@ -13,8 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
"""Limits action implementations."""
|
|
15
15
|
|
|
16
|
+
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
16
18
|
import logging
|
|
19
|
+
from typing import Any
|
|
17
20
|
|
|
21
|
+
from openstack import utils as sdk_utils
|
|
18
22
|
from osc_lib import exceptions
|
|
19
23
|
from osc_lib import utils
|
|
20
24
|
|
|
@@ -25,7 +29,7 @@ from openstackclient.identity import common as common_utils
|
|
|
25
29
|
LOG = logging.getLogger(__name__)
|
|
26
30
|
|
|
27
31
|
|
|
28
|
-
def _format_limit(limit):
|
|
32
|
+
def _format_limit(limit: Any) -> tuple[tuple[str, ...], Any]:
|
|
29
33
|
columns = (
|
|
30
34
|
"description",
|
|
31
35
|
"id",
|
|
@@ -50,7 +54,7 @@ def _format_limit(limit):
|
|
|
50
54
|
class CreateLimit(command.ShowOne):
|
|
51
55
|
_description = _("Create a limit")
|
|
52
56
|
|
|
53
|
-
def get_parser(self, prog_name):
|
|
57
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
54
58
|
parser = super().get_parser(prog_name)
|
|
55
59
|
parser.add_argument(
|
|
56
60
|
'--description',
|
|
@@ -89,8 +93,12 @@ class CreateLimit(command.ShowOne):
|
|
|
89
93
|
)
|
|
90
94
|
return parser
|
|
91
95
|
|
|
92
|
-
def take_action(
|
|
93
|
-
|
|
96
|
+
def take_action(
|
|
97
|
+
self, parsed_args: argparse.Namespace
|
|
98
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
99
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
100
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
101
|
+
)
|
|
94
102
|
|
|
95
103
|
kwargs = {
|
|
96
104
|
"resource_name": parsed_args.resource_name,
|
|
@@ -122,7 +130,7 @@ class CreateLimit(command.ShowOne):
|
|
|
122
130
|
class ListLimit(command.Lister):
|
|
123
131
|
_description = _("List limits")
|
|
124
132
|
|
|
125
|
-
def get_parser(self, prog_name):
|
|
133
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
126
134
|
parser = super().get_parser(prog_name)
|
|
127
135
|
parser.add_argument(
|
|
128
136
|
'--service',
|
|
@@ -149,8 +157,12 @@ class ListLimit(command.Lister):
|
|
|
149
157
|
|
|
150
158
|
return parser
|
|
151
159
|
|
|
152
|
-
def take_action(
|
|
153
|
-
|
|
160
|
+
def take_action(
|
|
161
|
+
self, parsed_args: argparse.Namespace
|
|
162
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
163
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
164
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
165
|
+
)
|
|
154
166
|
|
|
155
167
|
kwargs = {}
|
|
156
168
|
if parsed_args.service:
|
|
@@ -199,7 +211,7 @@ class ListLimit(command.Lister):
|
|
|
199
211
|
class ShowLimit(command.ShowOne):
|
|
200
212
|
_description = _("Display limit details")
|
|
201
213
|
|
|
202
|
-
def get_parser(self, prog_name):
|
|
214
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
203
215
|
parser = super().get_parser(prog_name)
|
|
204
216
|
parser.add_argument(
|
|
205
217
|
'limit_id',
|
|
@@ -208,8 +220,12 @@ class ShowLimit(command.ShowOne):
|
|
|
208
220
|
)
|
|
209
221
|
return parser
|
|
210
222
|
|
|
211
|
-
def take_action(
|
|
212
|
-
|
|
223
|
+
def take_action(
|
|
224
|
+
self, parsed_args: argparse.Namespace
|
|
225
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
226
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
227
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
228
|
+
)
|
|
213
229
|
limit = identity_client.get_limit(parsed_args.limit_id)
|
|
214
230
|
return _format_limit(limit)
|
|
215
231
|
|
|
@@ -217,7 +233,7 @@ class ShowLimit(command.ShowOne):
|
|
|
217
233
|
class SetLimit(command.ShowOne):
|
|
218
234
|
_description = _("Update information about a limit")
|
|
219
235
|
|
|
220
|
-
def get_parser(self, prog_name):
|
|
236
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
221
237
|
parser = super().get_parser(prog_name)
|
|
222
238
|
parser.add_argument(
|
|
223
239
|
'limit_id',
|
|
@@ -238,8 +254,12 @@ class SetLimit(command.ShowOne):
|
|
|
238
254
|
)
|
|
239
255
|
return parser
|
|
240
256
|
|
|
241
|
-
def take_action(
|
|
242
|
-
|
|
257
|
+
def take_action(
|
|
258
|
+
self, parsed_args: argparse.Namespace
|
|
259
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
260
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
261
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
262
|
+
)
|
|
243
263
|
|
|
244
264
|
kwargs = {}
|
|
245
265
|
if parsed_args.description:
|
|
@@ -254,7 +274,7 @@ class SetLimit(command.ShowOne):
|
|
|
254
274
|
class DeleteLimit(command.Command):
|
|
255
275
|
_description = _("Delete a limit")
|
|
256
276
|
|
|
257
|
-
def get_parser(self, prog_name):
|
|
277
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
258
278
|
parser = super().get_parser(prog_name)
|
|
259
279
|
parser.add_argument(
|
|
260
280
|
'limit_id',
|
|
@@ -267,8 +287,10 @@ class DeleteLimit(command.Command):
|
|
|
267
287
|
)
|
|
268
288
|
return parser
|
|
269
289
|
|
|
270
|
-
def take_action(self, parsed_args):
|
|
271
|
-
identity_client =
|
|
290
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
291
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
292
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
293
|
+
)
|
|
272
294
|
|
|
273
295
|
errors = 0
|
|
274
296
|
for limit_id in parsed_args.limit_id:
|
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v3 federation mapping action implementations"""
|
|
17
17
|
|
|
18
|
+
import argparse
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
18
20
|
import json
|
|
19
21
|
import logging
|
|
22
|
+
from typing import Any
|
|
20
23
|
|
|
21
24
|
from osc_lib import exceptions
|
|
22
25
|
from osc_lib import utils
|
|
@@ -31,7 +34,7 @@ LOG = logging.getLogger(__name__)
|
|
|
31
34
|
class _RulesReader:
|
|
32
35
|
_description = _("Helper class capable of reading rules from files")
|
|
33
36
|
|
|
34
|
-
def _read_rules(self, path):
|
|
37
|
+
def _read_rules(self, path: str) -> Any:
|
|
35
38
|
"""Read and parse rules from path
|
|
36
39
|
|
|
37
40
|
Expect the file to contain a valid JSON structure.
|
|
@@ -82,7 +85,9 @@ class _RulesReader:
|
|
|
82
85
|
return rules
|
|
83
86
|
|
|
84
87
|
@staticmethod
|
|
85
|
-
def add_federated_schema_version_option(
|
|
88
|
+
def add_federated_schema_version_option(
|
|
89
|
+
parser: argparse.ArgumentParser,
|
|
90
|
+
) -> None:
|
|
86
91
|
parser.add_argument(
|
|
87
92
|
'--schema-version',
|
|
88
93
|
metavar='<schema_version>',
|
|
@@ -100,7 +105,7 @@ class _RulesReader:
|
|
|
100
105
|
class CreateMapping(command.ShowOne, _RulesReader):
|
|
101
106
|
_description = _("Create new mapping")
|
|
102
107
|
|
|
103
|
-
def get_parser(self, prog_name):
|
|
108
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
104
109
|
parser = super().get_parser(prog_name)
|
|
105
110
|
parser.add_argument(
|
|
106
111
|
'mapping',
|
|
@@ -116,7 +121,9 @@ class CreateMapping(command.ShowOne, _RulesReader):
|
|
|
116
121
|
_RulesReader.add_federated_schema_version_option(parser)
|
|
117
122
|
return parser
|
|
118
123
|
|
|
119
|
-
def take_action(
|
|
124
|
+
def take_action(
|
|
125
|
+
self, parsed_args: argparse.Namespace
|
|
126
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
120
127
|
identity_client = self.app.client_manager.identity
|
|
121
128
|
|
|
122
129
|
rules = self._read_rules(parsed_args.rules)
|
|
@@ -127,13 +134,14 @@ class CreateMapping(command.ShowOne, _RulesReader):
|
|
|
127
134
|
)
|
|
128
135
|
|
|
129
136
|
mapping._info.pop('links', None)
|
|
130
|
-
|
|
137
|
+
col_headers, col_data = zip(*sorted(mapping._info.items()))
|
|
138
|
+
return col_headers, col_data
|
|
131
139
|
|
|
132
140
|
|
|
133
141
|
class DeleteMapping(command.Command):
|
|
134
142
|
_description = _("Delete mapping(s)")
|
|
135
143
|
|
|
136
|
-
def get_parser(self, prog_name):
|
|
144
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
137
145
|
parser = super().get_parser(prog_name)
|
|
138
146
|
parser.add_argument(
|
|
139
147
|
'mapping',
|
|
@@ -143,7 +151,7 @@ class DeleteMapping(command.Command):
|
|
|
143
151
|
)
|
|
144
152
|
return parser
|
|
145
153
|
|
|
146
|
-
def take_action(self, parsed_args):
|
|
154
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
147
155
|
identity_client = self.app.client_manager.identity
|
|
148
156
|
result = 0
|
|
149
157
|
for i in parsed_args.mapping:
|
|
@@ -171,7 +179,9 @@ class DeleteMapping(command.Command):
|
|
|
171
179
|
class ListMapping(command.Lister):
|
|
172
180
|
_description = _("List mappings")
|
|
173
181
|
|
|
174
|
-
def take_action(
|
|
182
|
+
def take_action(
|
|
183
|
+
self, parsed_args: argparse.Namespace
|
|
184
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
175
185
|
# NOTE(marek-denis): Since rules can be long and tedious I have decided
|
|
176
186
|
# to only list ids of the mappings. If somebody wants to check the
|
|
177
187
|
# rules, (s)he should show specific ones.
|
|
@@ -185,7 +195,7 @@ class ListMapping(command.Lister):
|
|
|
185
195
|
class SetMapping(command.Command, _RulesReader):
|
|
186
196
|
_description = _("Set mapping properties")
|
|
187
197
|
|
|
188
|
-
def get_parser(self, prog_name):
|
|
198
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
189
199
|
parser = super().get_parser(prog_name)
|
|
190
200
|
parser.add_argument(
|
|
191
201
|
'mapping',
|
|
@@ -201,7 +211,7 @@ class SetMapping(command.Command, _RulesReader):
|
|
|
201
211
|
_RulesReader.add_federated_schema_version_option(parser)
|
|
202
212
|
return parser
|
|
203
213
|
|
|
204
|
-
def take_action(self, parsed_args):
|
|
214
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
205
215
|
identity_client = self.app.client_manager.identity
|
|
206
216
|
|
|
207
217
|
rules = self._read_rules(parsed_args.rules)
|
|
@@ -218,7 +228,7 @@ class SetMapping(command.Command, _RulesReader):
|
|
|
218
228
|
class ShowMapping(command.ShowOne):
|
|
219
229
|
_description = _("Display mapping details")
|
|
220
230
|
|
|
221
|
-
def get_parser(self, prog_name):
|
|
231
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
222
232
|
parser = super().get_parser(prog_name)
|
|
223
233
|
parser.add_argument(
|
|
224
234
|
'mapping',
|
|
@@ -227,10 +237,13 @@ class ShowMapping(command.ShowOne):
|
|
|
227
237
|
)
|
|
228
238
|
return parser
|
|
229
239
|
|
|
230
|
-
def take_action(
|
|
240
|
+
def take_action(
|
|
241
|
+
self, parsed_args: argparse.Namespace
|
|
242
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
231
243
|
identity_client = self.app.client_manager.identity
|
|
232
244
|
|
|
233
245
|
mapping = identity_client.federation.mappings.get(parsed_args.mapping)
|
|
234
246
|
|
|
235
247
|
mapping._info.pop('links', None)
|
|
236
|
-
|
|
248
|
+
col_headers, col_data = zip(*sorted(mapping._info.items()))
|
|
249
|
+
return col_headers, col_data
|