python-openstackclient 9.0.0__py3-none-any.whl → 10.1.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 +59 -43
- 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 +36 -34
- openstackclient/common/pagination.py +50 -6
- openstackclient/common/progressbar.py +7 -6
- openstackclient/common/project_cleanup.py +11 -6
- openstackclient/common/quota.py +105 -103
- 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 +42 -22
- openstackclient/compute/v2/host.py +14 -6
- openstackclient/compute/v2/hypervisor.py +16 -5
- openstackclient/compute/v2/hypervisor_stats.py +10 -2
- openstackclient/compute/v2/keypair.py +35 -16
- openstackclient/compute/v2/server.py +268 -179
- openstackclient/compute/v2/server_backup.py +10 -4
- openstackclient/compute/v2/server_event.py +28 -12
- openstackclient/compute/v2/server_group.py +23 -11
- openstackclient/compute/v2/server_image.py +19 -10
- openstackclient/compute/v2/server_migration.py +27 -10
- openstackclient/compute/v2/server_share.py +274 -0
- openstackclient/compute/v2/server_volume.py +13 -5
- openstackclient/compute/v2/service.py +17 -8
- openstackclient/compute/v2/usage.py +28 -23
- openstackclient/identity/client.py +8 -3
- openstackclient/identity/common.py +82 -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 +32 -12
- openstackclient/identity/v3/application_credential.py +66 -24
- openstackclient/identity/v3/catalog.py +14 -7
- openstackclient/identity/v3/consumer.py +22 -11
- openstackclient/identity/v3/credential.py +39 -17
- openstackclient/identity/v3/domain.py +40 -19
- openstackclient/identity/v3/ec2creds.py +25 -12
- openstackclient/identity/v3/endpoint.py +98 -64
- openstackclient/identity/v3/endpoint_group.py +28 -17
- openstackclient/identity/v3/federation_protocol.py +44 -20
- openstackclient/identity/v3/group.py +64 -40
- openstackclient/identity/v3/identity_provider.py +95 -57
- openstackclient/identity/v3/implied_role.py +21 -9
- openstackclient/identity/v3/limit.py +42 -17
- openstackclient/identity/v3/mapping.py +58 -28
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +59 -26
- openstackclient/identity/v3/region.py +39 -17
- openstackclient/identity/v3/registered_limit.py +41 -16
- openstackclient/identity/v3/role.py +62 -31
- openstackclient/identity/v3/role_assignment.py +25 -7
- openstackclient/identity/v3/service.py +39 -17
- openstackclient/identity/v3/service_provider.py +40 -16
- openstackclient/identity/v3/tag.py +23 -6
- openstackclient/identity/v3/token.py +30 -14
- openstackclient/identity/v3/trust.py +39 -18
- openstackclient/identity/v3/unscoped_saml.py +10 -2
- openstackclient/identity/v3/user.py +86 -36
- openstackclient/image/client.py +7 -3
- openstackclient/image/v1/image.py +33 -26
- openstackclient/image/v2/cache.py +16 -11
- openstackclient/image/v2/image.py +88 -56
- openstackclient/image/v2/info.py +7 -1
- openstackclient/image/v2/metadef_namespaces.py +117 -20
- openstackclient/image/v2/metadef_objects.py +32 -19
- openstackclient/image/v2/metadef_properties.py +30 -16
- openstackclient/image/v2/metadef_resource_type_association.py +14 -7
- openstackclient/image/v2/metadef_resource_types.py +7 -1
- openstackclient/image/v2/task.py +25 -27
- 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 +27 -54
- openstackclient/network/v2/address_group.py +39 -16
- openstackclient/network/v2/address_scope.py +36 -20
- openstackclient/network/v2/bgpvpn/bgpvpn.py +477 -0
- openstackclient/network/v2/bgpvpn/constants.py +30 -0
- openstackclient/network/v2/bgpvpn/network_association.py +226 -0
- openstackclient/network/v2/bgpvpn/port_association.py +504 -0
- openstackclient/network/v2/bgpvpn/router_association.py +301 -0
- openstackclient/network/v2/default_security_group_rule.py +31 -14
- openstackclient/network/v2/floating_ip.py +121 -162
- openstackclient/network/v2/floating_ip_port_forwarding.py +41 -19
- openstackclient/network/v2/fwaas/__init__.py +0 -0
- openstackclient/network/v2/fwaas/group.py +499 -0
- openstackclient/network/v2/fwaas/policy.py +518 -0
- openstackclient/network/v2/fwaas/rule.py +610 -0
- openstackclient/network/v2/ip_availability.py +25 -8
- openstackclient/network/v2/l3_conntrack_helper.py +35 -13
- openstackclient/network/v2/local_ip.py +27 -13
- openstackclient/network/v2/local_ip_association.py +17 -7
- openstackclient/network/v2/ndp_proxy.py +23 -11
- openstackclient/network/v2/network.py +213 -213
- openstackclient/network/v2/network_agent.py +77 -34
- openstackclient/network/v2/network_auto_allocated_topology.py +27 -15
- openstackclient/network/v2/network_flavor.py +45 -21
- openstackclient/network/v2/network_flavor_profile.py +42 -17
- openstackclient/network/v2/network_meter.py +39 -15
- openstackclient/network/v2/network_meter_rule.py +40 -12
- openstackclient/network/v2/network_qos_policy.py +39 -21
- openstackclient/network/v2/network_qos_rule.py +48 -18
- openstackclient/network/v2/network_qos_rule_type.py +28 -9
- openstackclient/network/v2/network_rbac.py +34 -16
- openstackclient/network/v2/network_segment.py +32 -11
- openstackclient/network/v2/network_segment_range.py +70 -31
- openstackclient/network/v2/network_service_provider.py +7 -1
- openstackclient/network/v2/network_trunk.py +41 -22
- openstackclient/network/v2/port.py +141 -40
- openstackclient/network/v2/router.py +101 -67
- openstackclient/network/v2/security_group.py +97 -198
- openstackclient/network/v2/security_group_rule.py +115 -282
- openstackclient/network/v2/subnet.py +63 -34
- openstackclient/network/v2/subnet_pool.py +42 -24
- openstackclient/network/v2/taas/tap_flow.py +35 -14
- openstackclient/network/v2/taas/tap_mirror.py +28 -14
- openstackclient/network/v2/taas/tap_service.py +26 -12
- openstackclient/object/client.py +7 -2
- openstackclient/object/v1/account.py +13 -6
- openstackclient/object/v1/container.py +28 -16
- openstackclient/object/v1/object.py +28 -16
- 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 +59 -19
- openstackclient/tests/functional/identity/v3/test_application_credential.py +1 -1
- 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_mapping.py +81 -0
- 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_group.py +163 -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_limits.py +1 -1
- openstackclient/tests/unit/common/test_module.py +82 -44
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +15 -26
- openstackclient/tests/unit/compute/v2/fakes.py +26 -57
- openstackclient/tests/unit/compute/v2/test_agent.py +4 -4
- openstackclient/tests/unit/compute/v2/test_aggregate.py +1 -1
- openstackclient/tests/unit/compute/v2/test_console.py +2 -2
- openstackclient/tests/unit/compute/v2/test_console_connection.py +1 -1
- openstackclient/tests/unit/compute/v2/test_flavor.py +29 -3
- openstackclient/tests/unit/compute/v2/test_host.py +3 -3
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +2 -2
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -1
- openstackclient/tests/unit/compute/v2/test_keypair.py +7 -7
- openstackclient/tests/unit/compute/v2/test_server.py +26 -111
- openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_event.py +2 -2
- openstackclient/tests/unit/compute/v2/test_server_group.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_image.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_migration.py +4 -4
- openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
- openstackclient/tests/unit/compute/v2/test_server_volume.py +2 -2
- openstackclient/tests/unit/compute/v2/test_service.py +3 -3
- openstackclient/tests/unit/compute/v2/test_usage.py +1 -1
- openstackclient/tests/unit/identity/v2_0/fakes.py +3 -7
- openstackclient/tests/unit/identity/v2_0/test_endpoint.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_project.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_role.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_service.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_token.py +2 -2
- openstackclient/tests/unit/identity/v2_0/test_user.py +1 -1
- openstackclient/tests/unit/identity/v3/fakes.py +8 -38
- openstackclient/tests/unit/identity/v3/test_access_rule.py +3 -3
- openstackclient/tests/unit/identity/v3/test_application_credential.py +4 -4
- openstackclient/tests/unit/identity/v3/test_credential.py +5 -5
- openstackclient/tests/unit/identity/v3/test_domain.py +5 -5
- openstackclient/tests/unit/identity/v3/test_endpoint.py +6 -6
- openstackclient/tests/unit/identity/v3/test_endpoint_group.py +1 -1
- openstackclient/tests/unit/identity/v3/test_group.py +12 -22
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
- openstackclient/tests/unit/identity/v3/test_implied_role.py +1 -1
- openstackclient/tests/unit/identity/v3/test_limit.py +5 -5
- openstackclient/tests/unit/identity/v3/test_mappings.py +163 -79
- openstackclient/tests/unit/identity/v3/test_project.py +28 -5
- openstackclient/tests/unit/identity/v3/test_protocol.py +3 -3
- openstackclient/tests/unit/identity/v3/test_region.py +5 -5
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +5 -5
- openstackclient/tests/unit/identity/v3/test_role.py +8 -8
- openstackclient/tests/unit/identity/v3/test_role_assignment.py +1 -1
- openstackclient/tests/unit/identity/v3/test_service.py +5 -5
- openstackclient/tests/unit/identity/v3/test_token.py +2 -2
- openstackclient/tests/unit/identity/v3/test_trust.py +4 -4
- openstackclient/tests/unit/identity/v3/test_user.py +77 -10
- 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/fakes.py +5 -77
- openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +923 -0
- openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +1005 -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 +26 -2
- openstackclient/tests/unit/network/v2/test_address_scope.py +24 -0
- openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +27 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +37 -13
- openstackclient/tests/unit/network/v2/test_ip_availability.py +25 -0
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +29 -3
- openstackclient/tests/unit/network/v2/test_network.py +74 -12
- openstackclient/tests/unit/network/v2/test_network_agent.py +58 -5
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
- openstackclient/tests/unit/network/v2/test_network_flavor.py +26 -2
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_meter.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_rbac.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_segment.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +31 -10
- openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/unit/network/v2/test_port.py +166 -0
- openstackclient/tests/unit/network/v2/test_router.py +36 -16
- openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +11 -8
- openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +28 -37
- openstackclient/tests/unit/network/v2/test_subnet.py +30 -5
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +26 -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 +21 -140
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +6 -14
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +8 -1
- openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
- openstackclient/tests/unit/volume/v3/fakes.py +205 -100
- openstackclient/tests/unit/volume/v3/test_backup_record.py +114 -0
- openstackclient/tests/unit/volume/v3/test_consistency_group.py +720 -0
- openstackclient/tests/unit/volume/v3/test_consistency_group_snapshot.py +354 -0
- openstackclient/tests/unit/volume/v3/test_qos_specs.py +455 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +60 -3
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +3 -1
- openstackclient/tests/unit/volume/v3/test_volume_backend.py +158 -0
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +6 -14
- openstackclient/tests/unit/volume/v3/test_volume_group_type.py +65 -0
- openstackclient/tests/unit/volume/v3/test_volume_host.py +115 -0
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +61 -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 +60 -30
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +48 -23
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +49 -24
- openstackclient/volume/v2/volume_transfer_request.py +31 -13
- openstackclient/volume/v2/volume_type.py +43 -24
- openstackclient/volume/v3/backup_record.py +94 -0
- 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/consistency_group.py +400 -0
- openstackclient/volume/v3/consistency_group_snapshot.py +225 -0
- openstackclient/volume/v3/qos_specs.py +389 -0
- openstackclient/volume/v3/service.py +16 -6
- openstackclient/volume/v3/volume.py +92 -40
- openstackclient/volume/v3/volume_attachment.py +47 -21
- openstackclient/volume/v3/volume_backend.py +130 -0
- openstackclient/volume/v3/volume_backup.py +55 -27
- openstackclient/volume/v3/volume_group.py +23 -13
- openstackclient/volume/v3/volume_group_snapshot.py +34 -17
- openstackclient/volume/v3/volume_group_type.py +27 -14
- openstackclient/volume/v3/volume_host.py +74 -0
- openstackclient/volume/v3/volume_message.py +18 -8
- openstackclient/volume/v3/volume_snapshot.py +70 -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.1.0.dist-info}/METADATA +7 -8
- python_openstackclient-10.1.0.dist-info/RECORD +524 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/entry_points.txt +77 -25
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/AUTHORS +9 -0
- python_openstackclient-10.1.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/RECORD +0 -499
- 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.1.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/top_level.txt +0 -0
|
@@ -15,9 +15,14 @@
|
|
|
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
|
|
|
24
|
+
from openstack.identity.v3 import mapping as _mapping
|
|
25
|
+
from openstack import utils as sdk_utils
|
|
21
26
|
from osc_lib import exceptions
|
|
22
27
|
from osc_lib import utils
|
|
23
28
|
|
|
@@ -28,10 +33,21 @@ from openstackclient.i18n import _
|
|
|
28
33
|
LOG = logging.getLogger(__name__)
|
|
29
34
|
|
|
30
35
|
|
|
36
|
+
def _format_mapping(
|
|
37
|
+
mapping: _mapping.Mapping,
|
|
38
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
39
|
+
columns = ('id', 'rules', 'schema_version')
|
|
40
|
+
column_headers = ('id', 'rules', 'schema_version')
|
|
41
|
+
return (
|
|
42
|
+
column_headers,
|
|
43
|
+
utils.get_item_properties(mapping, columns),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
31
47
|
class _RulesReader:
|
|
32
48
|
_description = _("Helper class capable of reading rules from files")
|
|
33
49
|
|
|
34
|
-
def _read_rules(self, path):
|
|
50
|
+
def _read_rules(self, path: str) -> Any:
|
|
35
51
|
"""Read and parse rules from path
|
|
36
52
|
|
|
37
53
|
Expect the file to contain a valid JSON structure.
|
|
@@ -82,7 +98,9 @@ class _RulesReader:
|
|
|
82
98
|
return rules
|
|
83
99
|
|
|
84
100
|
@staticmethod
|
|
85
|
-
def add_federated_schema_version_option(
|
|
101
|
+
def add_federated_schema_version_option(
|
|
102
|
+
parser: argparse.ArgumentParser,
|
|
103
|
+
) -> None:
|
|
86
104
|
parser.add_argument(
|
|
87
105
|
'--schema-version',
|
|
88
106
|
metavar='<schema_version>',
|
|
@@ -100,7 +118,7 @@ class _RulesReader:
|
|
|
100
118
|
class CreateMapping(command.ShowOne, _RulesReader):
|
|
101
119
|
_description = _("Create new mapping")
|
|
102
120
|
|
|
103
|
-
def get_parser(self, prog_name):
|
|
121
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
104
122
|
parser = super().get_parser(prog_name)
|
|
105
123
|
parser.add_argument(
|
|
106
124
|
'mapping',
|
|
@@ -116,24 +134,27 @@ class CreateMapping(command.ShowOne, _RulesReader):
|
|
|
116
134
|
_RulesReader.add_federated_schema_version_option(parser)
|
|
117
135
|
return parser
|
|
118
136
|
|
|
119
|
-
def take_action(
|
|
120
|
-
|
|
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
|
+
)
|
|
121
143
|
|
|
122
144
|
rules = self._read_rules(parsed_args.rules)
|
|
123
|
-
mapping = identity_client.
|
|
124
|
-
|
|
145
|
+
mapping = identity_client.create_mapping(
|
|
146
|
+
id=parsed_args.mapping,
|
|
125
147
|
rules=rules,
|
|
126
148
|
schema_version=parsed_args.schema_version,
|
|
127
149
|
)
|
|
128
150
|
|
|
129
|
-
mapping
|
|
130
|
-
return zip(*sorted(mapping._info.items()))
|
|
151
|
+
return _format_mapping(mapping)
|
|
131
152
|
|
|
132
153
|
|
|
133
154
|
class DeleteMapping(command.Command):
|
|
134
155
|
_description = _("Delete mapping(s)")
|
|
135
156
|
|
|
136
|
-
def get_parser(self, prog_name):
|
|
157
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
137
158
|
parser = super().get_parser(prog_name)
|
|
138
159
|
parser.add_argument(
|
|
139
160
|
'mapping',
|
|
@@ -143,12 +164,14 @@ class DeleteMapping(command.Command):
|
|
|
143
164
|
)
|
|
144
165
|
return parser
|
|
145
166
|
|
|
146
|
-
def take_action(self, parsed_args):
|
|
147
|
-
identity_client =
|
|
167
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
168
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
169
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
170
|
+
)
|
|
148
171
|
result = 0
|
|
149
172
|
for i in parsed_args.mapping:
|
|
150
173
|
try:
|
|
151
|
-
identity_client.
|
|
174
|
+
identity_client.delete_mapping(i, ignore_missing=False)
|
|
152
175
|
except Exception as e:
|
|
153
176
|
result += 1
|
|
154
177
|
LOG.error(
|
|
@@ -171,12 +194,16 @@ class DeleteMapping(command.Command):
|
|
|
171
194
|
class ListMapping(command.Lister):
|
|
172
195
|
_description = _("List mappings")
|
|
173
196
|
|
|
174
|
-
def take_action(
|
|
197
|
+
def take_action(
|
|
198
|
+
self, parsed_args: argparse.Namespace
|
|
199
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
175
200
|
# NOTE(marek-denis): Since rules can be long and tedious I have decided
|
|
176
201
|
# to only list ids of the mappings. If somebody wants to check the
|
|
177
202
|
# rules, (s)he should show specific ones.
|
|
178
|
-
identity_client =
|
|
179
|
-
|
|
203
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
204
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
205
|
+
)
|
|
206
|
+
data = identity_client.mappings()
|
|
180
207
|
columns = ('ID', 'schema_version')
|
|
181
208
|
items = [utils.get_item_properties(s, columns) for s in data]
|
|
182
209
|
return (columns, items)
|
|
@@ -185,7 +212,7 @@ class ListMapping(command.Lister):
|
|
|
185
212
|
class SetMapping(command.Command, _RulesReader):
|
|
186
213
|
_description = _("Set mapping properties")
|
|
187
214
|
|
|
188
|
-
def get_parser(self, prog_name):
|
|
215
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
189
216
|
parser = super().get_parser(prog_name)
|
|
190
217
|
parser.add_argument(
|
|
191
218
|
'mapping',
|
|
@@ -201,24 +228,24 @@ class SetMapping(command.Command, _RulesReader):
|
|
|
201
228
|
_RulesReader.add_federated_schema_version_option(parser)
|
|
202
229
|
return parser
|
|
203
230
|
|
|
204
|
-
def take_action(self, parsed_args):
|
|
205
|
-
identity_client =
|
|
231
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
232
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
233
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
234
|
+
)
|
|
206
235
|
|
|
207
236
|
rules = self._read_rules(parsed_args.rules)
|
|
208
237
|
|
|
209
|
-
|
|
238
|
+
identity_client.update_mapping(
|
|
210
239
|
mapping=parsed_args.mapping,
|
|
211
240
|
rules=rules,
|
|
212
241
|
schema_version=parsed_args.schema_version,
|
|
213
242
|
)
|
|
214
243
|
|
|
215
|
-
mapping._info.pop('links', None)
|
|
216
|
-
|
|
217
244
|
|
|
218
245
|
class ShowMapping(command.ShowOne):
|
|
219
246
|
_description = _("Display mapping details")
|
|
220
247
|
|
|
221
|
-
def get_parser(self, prog_name):
|
|
248
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
222
249
|
parser = super().get_parser(prog_name)
|
|
223
250
|
parser.add_argument(
|
|
224
251
|
'mapping',
|
|
@@ -227,10 +254,13 @@ class ShowMapping(command.ShowOne):
|
|
|
227
254
|
)
|
|
228
255
|
return parser
|
|
229
256
|
|
|
230
|
-
def take_action(
|
|
231
|
-
|
|
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
|
+
)
|
|
232
263
|
|
|
233
|
-
mapping = identity_client.
|
|
264
|
+
mapping = identity_client.get_mapping(parsed_args.mapping)
|
|
234
265
|
|
|
235
|
-
mapping
|
|
236
|
-
return zip(*sorted(mapping._info.items()))
|
|
266
|
+
return _format_mapping(mapping)
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v3 Policy 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 CreatePolicy(command.ShowOne):
|
|
31
34
|
_description = _("Create new policy")
|
|
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
|
'--type',
|
|
@@ -48,7 +51,9 @@ class CreatePolicy(command.ShowOne):
|
|
|
48
51
|
)
|
|
49
52
|
return parser
|
|
50
53
|
|
|
51
|
-
def take_action(
|
|
54
|
+
def take_action(
|
|
55
|
+
self, parsed_args: argparse.Namespace
|
|
56
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
52
57
|
blob = utils.read_blob_file_contents(parsed_args.rules)
|
|
53
58
|
|
|
54
59
|
identity_client = self.app.client_manager.identity
|
|
@@ -58,13 +63,14 @@ class CreatePolicy(command.ShowOne):
|
|
|
58
63
|
|
|
59
64
|
policy._info.pop('links')
|
|
60
65
|
policy._info.update({'rules': policy._info.pop('blob')})
|
|
61
|
-
|
|
66
|
+
col_headers, col_data = zip(*sorted(policy._info.items()))
|
|
67
|
+
return col_headers, col_data
|
|
62
68
|
|
|
63
69
|
|
|
64
70
|
class DeletePolicy(command.Command):
|
|
65
71
|
_description = _("Delete policy(s)")
|
|
66
72
|
|
|
67
|
-
def get_parser(self, prog_name):
|
|
73
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
68
74
|
parser = super().get_parser(prog_name)
|
|
69
75
|
parser.add_argument(
|
|
70
76
|
'policy',
|
|
@@ -74,7 +80,7 @@ class DeletePolicy(command.Command):
|
|
|
74
80
|
)
|
|
75
81
|
return parser
|
|
76
82
|
|
|
77
|
-
def take_action(self, parsed_args):
|
|
83
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
78
84
|
identity_client = self.app.client_manager.identity
|
|
79
85
|
result = 0
|
|
80
86
|
for i in parsed_args.policy:
|
|
@@ -102,7 +108,7 @@ class DeletePolicy(command.Command):
|
|
|
102
108
|
class ListPolicy(command.Lister):
|
|
103
109
|
_description = _("List policies")
|
|
104
110
|
|
|
105
|
-
def get_parser(self, prog_name):
|
|
111
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
106
112
|
parser = super().get_parser(prog_name)
|
|
107
113
|
parser.add_argument(
|
|
108
114
|
'--long',
|
|
@@ -112,7 +118,9 @@ class ListPolicy(command.Lister):
|
|
|
112
118
|
)
|
|
113
119
|
return parser
|
|
114
120
|
|
|
115
|
-
def take_action(
|
|
121
|
+
def take_action(
|
|
122
|
+
self, parsed_args: argparse.Namespace
|
|
123
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
116
124
|
columns: tuple[str, ...] = ('ID', 'Type')
|
|
117
125
|
column_headers: tuple[str, ...] = columns
|
|
118
126
|
if parsed_args.long:
|
|
@@ -135,7 +143,7 @@ class ListPolicy(command.Lister):
|
|
|
135
143
|
class SetPolicy(command.Command):
|
|
136
144
|
_description = _("Set policy properties")
|
|
137
145
|
|
|
138
|
-
def get_parser(self, prog_name):
|
|
146
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
139
147
|
parser = super().get_parser(prog_name)
|
|
140
148
|
parser.add_argument(
|
|
141
149
|
'policy',
|
|
@@ -154,7 +162,7 @@ class SetPolicy(command.Command):
|
|
|
154
162
|
)
|
|
155
163
|
return parser
|
|
156
164
|
|
|
157
|
-
def take_action(self, parsed_args):
|
|
165
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
158
166
|
identity_client = self.app.client_manager.identity
|
|
159
167
|
blob = None
|
|
160
168
|
|
|
@@ -173,7 +181,7 @@ class SetPolicy(command.Command):
|
|
|
173
181
|
class ShowPolicy(command.ShowOne):
|
|
174
182
|
_description = _("Display policy details")
|
|
175
183
|
|
|
176
|
-
def get_parser(self, prog_name):
|
|
184
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
177
185
|
parser = super().get_parser(prog_name)
|
|
178
186
|
parser.add_argument(
|
|
179
187
|
'policy',
|
|
@@ -182,7 +190,9 @@ class ShowPolicy(command.ShowOne):
|
|
|
182
190
|
)
|
|
183
191
|
return parser
|
|
184
192
|
|
|
185
|
-
def take_action(
|
|
193
|
+
def take_action(
|
|
194
|
+
self, parsed_args: argparse.Namespace
|
|
195
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
186
196
|
identity_client = self.app.client_manager.identity
|
|
187
197
|
policy = utils.find_resource(
|
|
188
198
|
identity_client.policies, parsed_args.policy
|
|
@@ -190,4 +200,5 @@ class ShowPolicy(command.ShowOne):
|
|
|
190
200
|
|
|
191
201
|
policy._info.pop('links')
|
|
192
202
|
policy._info.update({'rules': policy._info.pop('blob')})
|
|
193
|
-
|
|
203
|
+
col_headers, col_data = zip(*sorted(policy._info.items()))
|
|
204
|
+
return col_headers, col_data
|
|
@@ -15,14 +15,20 @@
|
|
|
15
15
|
|
|
16
16
|
"""Project 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 openstack import exceptions as sdk_exc
|
|
24
|
+
from openstack.identity.v3 import project as _project
|
|
25
|
+
from openstack import utils as sdk_utils
|
|
21
26
|
from osc_lib.cli import parseractions
|
|
22
27
|
from osc_lib import exceptions
|
|
23
28
|
from osc_lib import utils
|
|
24
29
|
|
|
25
30
|
from openstackclient import command
|
|
31
|
+
from openstackclient.common import pagination
|
|
26
32
|
from openstackclient.i18n import _
|
|
27
33
|
from openstackclient.identity import common
|
|
28
34
|
from openstackclient.identity.v3 import tag
|
|
@@ -30,10 +36,12 @@ from openstackclient.identity.v3 import tag
|
|
|
30
36
|
LOG = logging.getLogger(__name__)
|
|
31
37
|
|
|
32
38
|
|
|
33
|
-
def _format_project(
|
|
39
|
+
def _format_project(
|
|
40
|
+
project: _project.Project,
|
|
41
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
34
42
|
# NOTE(0weng): Projects allow unknown attributes in the body, so extract
|
|
35
43
|
# the column names separately.
|
|
36
|
-
|
|
44
|
+
column_headers, columns = utils.get_osc_show_columns_for_sdk_resource(
|
|
37
45
|
project,
|
|
38
46
|
{'is_enabled': 'enabled'},
|
|
39
47
|
['links', 'location', 'parents_as_ids', 'subtree_as_ids'],
|
|
@@ -48,7 +56,7 @@ def _format_project(project):
|
|
|
48
56
|
class CreateProject(command.ShowOne):
|
|
49
57
|
_description = _("Create new project")
|
|
50
58
|
|
|
51
|
-
def get_parser(self, prog_name):
|
|
59
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
52
60
|
parser = super().get_parser(prog_name)
|
|
53
61
|
parser.add_argument(
|
|
54
62
|
'name',
|
|
@@ -104,8 +112,12 @@ class CreateProject(command.ShowOne):
|
|
|
104
112
|
tag.add_tag_option_to_parser_for_create(parser, _('project'))
|
|
105
113
|
return parser
|
|
106
114
|
|
|
107
|
-
def take_action(
|
|
108
|
-
|
|
115
|
+
def take_action(
|
|
116
|
+
self, parsed_args: argparse.Namespace
|
|
117
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
118
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
119
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
120
|
+
)
|
|
109
121
|
|
|
110
122
|
kwargs = {}
|
|
111
123
|
|
|
@@ -181,7 +193,7 @@ class DeleteProject(command.Command):
|
|
|
181
193
|
"regardless."
|
|
182
194
|
)
|
|
183
195
|
|
|
184
|
-
def get_parser(self, prog_name):
|
|
196
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
185
197
|
parser = super().get_parser(prog_name)
|
|
186
198
|
parser.add_argument(
|
|
187
199
|
'projects',
|
|
@@ -196,8 +208,10 @@ class DeleteProject(command.Command):
|
|
|
196
208
|
)
|
|
197
209
|
return parser
|
|
198
210
|
|
|
199
|
-
def take_action(self, parsed_args):
|
|
200
|
-
identity_client =
|
|
211
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
212
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
213
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
214
|
+
)
|
|
201
215
|
|
|
202
216
|
errors = 0
|
|
203
217
|
for project in parsed_args.projects:
|
|
@@ -232,7 +246,7 @@ class DeleteProject(command.Command):
|
|
|
232
246
|
class ListProject(command.Lister):
|
|
233
247
|
_description = _("List projects")
|
|
234
248
|
|
|
235
|
-
def get_parser(self, prog_name):
|
|
249
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
236
250
|
parser = super().get_parser(prog_name)
|
|
237
251
|
parser.add_argument(
|
|
238
252
|
'--domain',
|
|
@@ -287,10 +301,15 @@ class ListProject(command.Lister):
|
|
|
287
301
|
help=_('List only disabled projects'),
|
|
288
302
|
)
|
|
289
303
|
tag.add_tag_filtering_option_to_parser(parser, _('projects'))
|
|
304
|
+
pagination.add_marker_pagination_option_to_parser(parser)
|
|
290
305
|
return parser
|
|
291
306
|
|
|
292
|
-
def take_action(
|
|
293
|
-
|
|
307
|
+
def take_action(
|
|
308
|
+
self, parsed_args: argparse.Namespace
|
|
309
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
310
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
311
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
312
|
+
)
|
|
294
313
|
|
|
295
314
|
column_headers: tuple[str, ...] = ('ID', 'Name')
|
|
296
315
|
if parsed_args.long:
|
|
@@ -334,6 +353,13 @@ class ListProject(command.Lister):
|
|
|
334
353
|
if parsed_args.is_enabled is not None:
|
|
335
354
|
kwargs['is_enabled'] = parsed_args.is_enabled
|
|
336
355
|
|
|
356
|
+
if parsed_args.limit is not None:
|
|
357
|
+
kwargs['limit'] = parsed_args.limit
|
|
358
|
+
if parsed_args.max_items is not None:
|
|
359
|
+
kwargs['max_items'] = parsed_args.max_items
|
|
360
|
+
if parsed_args.marker is not None:
|
|
361
|
+
kwargs['marker'] = parsed_args.marker
|
|
362
|
+
|
|
337
363
|
tag.get_tag_filtering_args(parsed_args, kwargs)
|
|
338
364
|
|
|
339
365
|
if parsed_args.my_projects:
|
|
@@ -341,22 +367,23 @@ class ListProject(command.Lister):
|
|
|
341
367
|
kwargs = {}
|
|
342
368
|
user = self.app.client_manager.auth_ref.user_id
|
|
343
369
|
|
|
344
|
-
if user:
|
|
345
|
-
data = identity_client.user_projects(user, **kwargs)
|
|
346
|
-
else:
|
|
370
|
+
if not user:
|
|
347
371
|
try:
|
|
348
|
-
data = identity_client.projects(**kwargs)
|
|
372
|
+
data = list(identity_client.projects(**kwargs))
|
|
349
373
|
except sdk_exc.ForbiddenException:
|
|
350
374
|
# NOTE(adriant): if no filters, assume a forbidden is non-admin
|
|
351
375
|
# wanting their own project list.
|
|
352
376
|
if not kwargs:
|
|
353
377
|
user = self.app.client_manager.auth_ref.user_id
|
|
354
|
-
|
|
378
|
+
assert user is not None, 'this should not happen'
|
|
379
|
+
data = list(identity_client.user_projects(user))
|
|
355
380
|
else:
|
|
356
381
|
raise
|
|
382
|
+
else:
|
|
383
|
+
data = list(identity_client.user_projects(user, **kwargs))
|
|
357
384
|
|
|
358
385
|
if parsed_args.sort:
|
|
359
|
-
data = utils.sort_items(data, parsed_args.sort)
|
|
386
|
+
data = list(utils.sort_items(data, parsed_args.sort))
|
|
360
387
|
|
|
361
388
|
return (
|
|
362
389
|
column_headers,
|
|
@@ -367,7 +394,7 @@ class ListProject(command.Lister):
|
|
|
367
394
|
class SetProject(command.Command):
|
|
368
395
|
_description = _("Set project properties")
|
|
369
396
|
|
|
370
|
-
def get_parser(self, prog_name):
|
|
397
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
371
398
|
parser = super().get_parser(prog_name)
|
|
372
399
|
parser.add_argument(
|
|
373
400
|
'project',
|
|
@@ -418,8 +445,10 @@ class SetProject(command.Command):
|
|
|
418
445
|
tag.add_tag_option_to_parser_for_set(parser, _('project'))
|
|
419
446
|
return parser
|
|
420
447
|
|
|
421
|
-
def take_action(self, parsed_args):
|
|
422
|
-
identity_client =
|
|
448
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
449
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
450
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
451
|
+
)
|
|
423
452
|
|
|
424
453
|
kwargs = {}
|
|
425
454
|
if parsed_args.name:
|
|
@@ -481,7 +510,7 @@ class SetProject(command.Command):
|
|
|
481
510
|
class ShowProject(command.ShowOne):
|
|
482
511
|
_description = _("Display project details")
|
|
483
512
|
|
|
484
|
-
def get_parser(self, prog_name):
|
|
513
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
485
514
|
parser = super().get_parser(prog_name)
|
|
486
515
|
parser.add_argument(
|
|
487
516
|
'project',
|
|
@@ -507,10 +536,14 @@ class ShowProject(command.ShowOne):
|
|
|
507
536
|
)
|
|
508
537
|
return parser
|
|
509
538
|
|
|
510
|
-
def take_action(
|
|
511
|
-
|
|
539
|
+
def take_action(
|
|
540
|
+
self, parsed_args: argparse.Namespace
|
|
541
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
542
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
543
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
544
|
+
)
|
|
512
545
|
|
|
513
|
-
kwargs = {}
|
|
546
|
+
kwargs: dict[str, Any] = {}
|
|
514
547
|
|
|
515
548
|
domain = None
|
|
516
549
|
if parsed_args.domain:
|
|
@@ -536,8 +569,8 @@ class ShowProject(command.ShowOne):
|
|
|
536
569
|
if parsed_args.children:
|
|
537
570
|
kwargs['subtree_as_ids'] = True
|
|
538
571
|
|
|
539
|
-
|
|
572
|
+
project_obj = identity_client.find_project(
|
|
540
573
|
project, **kwargs, ignore_missing=False
|
|
541
574
|
)
|
|
542
575
|
|
|
543
|
-
return _format_project(
|
|
576
|
+
return _format_project(project_obj)
|
|
@@ -13,19 +13,25 @@
|
|
|
13
13
|
|
|
14
14
|
"""Identity v3 Region 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.identity.v3 import region as _region
|
|
22
|
+
from openstack import utils as sdk_utils
|
|
18
23
|
from osc_lib import exceptions
|
|
19
24
|
from osc_lib import utils
|
|
20
25
|
|
|
21
26
|
from openstackclient import command
|
|
22
27
|
from openstackclient.i18n import _
|
|
23
28
|
|
|
24
|
-
|
|
25
29
|
LOG = logging.getLogger(__name__)
|
|
26
30
|
|
|
27
31
|
|
|
28
|
-
def _format_region(
|
|
32
|
+
def _format_region(
|
|
33
|
+
region: _region.Region,
|
|
34
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
29
35
|
columns = ('id', 'description', 'parent_region_id')
|
|
30
36
|
column_headers = ('region', 'description', 'parent_region')
|
|
31
37
|
return (
|
|
@@ -37,7 +43,7 @@ def _format_region(region):
|
|
|
37
43
|
class CreateRegion(command.ShowOne):
|
|
38
44
|
_description = _("Create new region")
|
|
39
45
|
|
|
40
|
-
def get_parser(self, prog_name):
|
|
46
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
41
47
|
parser = super().get_parser(prog_name)
|
|
42
48
|
# NOTE(stevemar): The API supports an optional region ID, but that
|
|
43
49
|
# seems like poor UX, we will only support user-defined IDs.
|
|
@@ -58,8 +64,12 @@ class CreateRegion(command.ShowOne):
|
|
|
58
64
|
)
|
|
59
65
|
return parser
|
|
60
66
|
|
|
61
|
-
def take_action(
|
|
62
|
-
|
|
67
|
+
def take_action(
|
|
68
|
+
self, parsed_args: argparse.Namespace
|
|
69
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
70
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
71
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
72
|
+
)
|
|
63
73
|
|
|
64
74
|
region = identity_client.create_region(
|
|
65
75
|
id=parsed_args.region,
|
|
@@ -73,7 +83,7 @@ class CreateRegion(command.ShowOne):
|
|
|
73
83
|
class DeleteRegion(command.Command):
|
|
74
84
|
_description = _("Delete region(s)")
|
|
75
85
|
|
|
76
|
-
def get_parser(self, prog_name):
|
|
86
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
77
87
|
parser = super().get_parser(prog_name)
|
|
78
88
|
parser.add_argument(
|
|
79
89
|
'region',
|
|
@@ -83,8 +93,10 @@ class DeleteRegion(command.Command):
|
|
|
83
93
|
)
|
|
84
94
|
return parser
|
|
85
95
|
|
|
86
|
-
def take_action(self, parsed_args):
|
|
87
|
-
identity_client =
|
|
96
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
97
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
98
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
99
|
+
)
|
|
88
100
|
result = 0
|
|
89
101
|
for i in parsed_args.region:
|
|
90
102
|
try:
|
|
@@ -108,7 +120,7 @@ class DeleteRegion(command.Command):
|
|
|
108
120
|
class ListRegion(command.Lister):
|
|
109
121
|
_description = _("List regions")
|
|
110
122
|
|
|
111
|
-
def get_parser(self, prog_name):
|
|
123
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
112
124
|
parser = super().get_parser(prog_name)
|
|
113
125
|
parser.add_argument(
|
|
114
126
|
'--parent-region',
|
|
@@ -117,8 +129,12 @@ class ListRegion(command.Lister):
|
|
|
117
129
|
)
|
|
118
130
|
return parser
|
|
119
131
|
|
|
120
|
-
def take_action(
|
|
121
|
-
|
|
132
|
+
def take_action(
|
|
133
|
+
self, parsed_args: argparse.Namespace
|
|
134
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
135
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
136
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
137
|
+
)
|
|
122
138
|
|
|
123
139
|
kwargs = {}
|
|
124
140
|
if parsed_args.parent_region:
|
|
@@ -144,7 +160,7 @@ class ListRegion(command.Lister):
|
|
|
144
160
|
class SetRegion(command.Command):
|
|
145
161
|
_description = _("Set region properties")
|
|
146
162
|
|
|
147
|
-
def get_parser(self, prog_name):
|
|
163
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
148
164
|
parser = super().get_parser(prog_name)
|
|
149
165
|
parser.add_argument(
|
|
150
166
|
'region',
|
|
@@ -163,8 +179,10 @@ class SetRegion(command.Command):
|
|
|
163
179
|
)
|
|
164
180
|
return parser
|
|
165
181
|
|
|
166
|
-
def take_action(self, parsed_args):
|
|
167
|
-
identity_client =
|
|
182
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
183
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
184
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
185
|
+
)
|
|
168
186
|
|
|
169
187
|
kwargs = {}
|
|
170
188
|
if parsed_args.description:
|
|
@@ -178,7 +196,7 @@ class SetRegion(command.Command):
|
|
|
178
196
|
class ShowRegion(command.ShowOne):
|
|
179
197
|
_description = _("Display region details")
|
|
180
198
|
|
|
181
|
-
def get_parser(self, prog_name):
|
|
199
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
182
200
|
parser = super().get_parser(prog_name)
|
|
183
201
|
parser.add_argument(
|
|
184
202
|
'region',
|
|
@@ -187,8 +205,12 @@ class ShowRegion(command.ShowOne):
|
|
|
187
205
|
)
|
|
188
206
|
return parser
|
|
189
207
|
|
|
190
|
-
def take_action(
|
|
191
|
-
|
|
208
|
+
def take_action(
|
|
209
|
+
self, parsed_args: argparse.Namespace
|
|
210
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
211
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
212
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
213
|
+
)
|
|
192
214
|
|
|
193
215
|
region = identity_client.get_region(parsed_args.region)
|
|
194
216
|
|