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
|
@@ -14,13 +14,17 @@
|
|
|
14
14
|
"""Security Group Rule action implementations"""
|
|
15
15
|
|
|
16
16
|
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
17
18
|
import logging
|
|
19
|
+
from typing import Any
|
|
18
20
|
|
|
21
|
+
from openstack.network.v2 import security_group_rule as _security_group_rule
|
|
19
22
|
from osc_lib.cli import parseractions
|
|
20
23
|
from osc_lib import exceptions
|
|
21
24
|
from osc_lib import utils
|
|
22
25
|
|
|
23
|
-
from openstackclient
|
|
26
|
+
from openstackclient import command
|
|
27
|
+
from openstackclient.common import pagination
|
|
24
28
|
from openstackclient.i18n import _
|
|
25
29
|
from openstackclient.identity import common as identity_common
|
|
26
30
|
from openstackclient.network import common
|
|
@@ -29,21 +33,22 @@ from openstackclient.network import utils as network_utils
|
|
|
29
33
|
LOG = logging.getLogger(__name__)
|
|
30
34
|
|
|
31
35
|
|
|
32
|
-
def _get_columns(
|
|
36
|
+
def _get_columns(
|
|
37
|
+
item: _security_group_rule.SecurityGroupRule,
|
|
38
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
33
39
|
hidden_columns = ['location', 'name', 'tenant_id', 'tags']
|
|
34
40
|
return utils.get_osc_show_columns_for_sdk_resource(
|
|
35
41
|
item, {}, hidden_columns
|
|
36
42
|
)
|
|
37
43
|
|
|
38
44
|
|
|
39
|
-
# TODO(abhiraut): Use the SDK resource mapped attribute names once the
|
|
40
|
-
# OSC minimum requirements include SDK 1.0.
|
|
41
45
|
class CreateSecurityGroupRule(
|
|
42
|
-
|
|
46
|
+
command.ShowOne, common.NeutronCommandWithExtraArgs
|
|
43
47
|
):
|
|
44
48
|
_description = _("Create a new security group rule")
|
|
45
49
|
|
|
46
|
-
def
|
|
50
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
51
|
+
parser = super().get_parser(prog_name)
|
|
47
52
|
parser.add_argument(
|
|
48
53
|
'group',
|
|
49
54
|
metavar='<group>',
|
|
@@ -64,24 +69,11 @@ class CreateSecurityGroupRule(
|
|
|
64
69
|
metavar="<group>",
|
|
65
70
|
help=_("Remote security group (name or ID)"),
|
|
66
71
|
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
# NOTE(efried): The --dst-port, --protocol, and --proto options exist
|
|
75
|
-
# for both nova-network and neutron, but differ slightly. For the sake
|
|
76
|
-
# of the docs build, which has to account for both variants, but only
|
|
77
|
-
# add each to the parser once, they are handled here rather than in the
|
|
78
|
-
# _network- or _compute-specific methods below.
|
|
79
|
-
|
|
80
|
-
# --dst-port has a default for nova-net only
|
|
81
|
-
if self.is_nova_network:
|
|
82
|
-
dst_port_default = dict(default=(0, 0))
|
|
83
|
-
else:
|
|
84
|
-
dst_port_default = {}
|
|
72
|
+
remote_group.add_argument(
|
|
73
|
+
"--remote-address-group",
|
|
74
|
+
metavar="<group>",
|
|
75
|
+
help=_("Remote address group (name or ID)"),
|
|
76
|
+
)
|
|
85
77
|
parser.add_argument(
|
|
86
78
|
'--dst-port',
|
|
87
79
|
metavar='<port-range>',
|
|
@@ -91,115 +83,69 @@ class CreateSecurityGroupRule(
|
|
|
91
83
|
"ending port range: 137:139. Required for IP protocols TCP "
|
|
92
84
|
"and UDP. Ignored for ICMP IP protocols."
|
|
93
85
|
),
|
|
94
|
-
**dst_port_default,
|
|
95
86
|
)
|
|
96
|
-
|
|
97
|
-
# NOTE(rtheis): Support either protocol option name for now.
|
|
98
|
-
# However, consider deprecating and then removing --proto in
|
|
99
|
-
# a future release.
|
|
100
|
-
protocol_group = parser.add_mutually_exclusive_group()
|
|
101
|
-
# --proto[col] has choices for nova-network only
|
|
102
|
-
if self.is_nova_network:
|
|
103
|
-
proto_choices = dict(choices=['icmp', 'tcp', 'udp'])
|
|
104
|
-
else:
|
|
105
|
-
proto_choices = {}
|
|
106
|
-
protocol_help_compute = _("IP protocol (icmp, tcp, udp; default: tcp)")
|
|
107
|
-
protocol_help_network = _(
|
|
108
|
-
"IP protocol (ah, dccp, egp, esp, gre, icmp, igmp, ipv6-encap, "
|
|
109
|
-
"ipv6-frag, ipv6-icmp, ipv6-nonxt, ipv6-opts, ipv6-route, ospf, "
|
|
110
|
-
"pgm, rsvp, sctp, tcp, udp, udplite, vrrp and integer "
|
|
111
|
-
"representations [0-255] or any; default: any (all protocols))"
|
|
112
|
-
)
|
|
113
|
-
if self.is_nova_network:
|
|
114
|
-
protocol_help = protocol_help_compute
|
|
115
|
-
elif self.is_neutron:
|
|
116
|
-
protocol_help = protocol_help_network
|
|
117
|
-
else:
|
|
118
|
-
# Docs build: compose help for both nova-network and neutron
|
|
119
|
-
protocol_help = self.split_help(
|
|
120
|
-
protocol_help_network, protocol_help_compute
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
protocol_group.add_argument(
|
|
87
|
+
parser.add_argument(
|
|
124
88
|
'--protocol',
|
|
125
89
|
metavar='<protocol>',
|
|
126
90
|
type=network_utils.convert_to_lowercase,
|
|
127
|
-
help=
|
|
128
|
-
|
|
91
|
+
help=_(
|
|
92
|
+
"IP protocol (ah, dccp, egp, esp, gre, icmp, igmp, "
|
|
93
|
+
"ipv6-encap, ipv6-frag, ipv6-icmp, ipv6-nonxt, ipv6-opts, "
|
|
94
|
+
"ipv6-route, ospf, pgm, rsvp, sctp, tcp, udp, udplite, vrrp "
|
|
95
|
+
"and integer representations [0-255] or any; "
|
|
96
|
+
"default: any (all protocols))"
|
|
97
|
+
),
|
|
129
98
|
)
|
|
130
|
-
if not self.is_docs_build:
|
|
131
|
-
protocol_group.add_argument(
|
|
132
|
-
'--proto',
|
|
133
|
-
metavar='<proto>',
|
|
134
|
-
type=network_utils.convert_to_lowercase,
|
|
135
|
-
help=argparse.SUPPRESS,
|
|
136
|
-
**proto_choices,
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
return parser
|
|
140
|
-
|
|
141
|
-
def update_parser_network(self, parser):
|
|
142
99
|
parser.add_argument(
|
|
143
100
|
'--description',
|
|
144
101
|
metavar='<description>',
|
|
145
|
-
help=
|
|
146
|
-
_("Set security group rule description")
|
|
147
|
-
),
|
|
102
|
+
help=_("Set security group rule description"),
|
|
148
103
|
)
|
|
149
104
|
parser.add_argument(
|
|
150
105
|
'--icmp-type',
|
|
151
106
|
metavar='<icmp-type>',
|
|
152
107
|
type=int,
|
|
153
|
-
help=
|
|
154
|
-
_("ICMP type for ICMP IP protocols")
|
|
155
|
-
),
|
|
108
|
+
help=_("ICMP type for ICMP IP protocols"),
|
|
156
109
|
)
|
|
157
110
|
parser.add_argument(
|
|
158
111
|
'--icmp-code',
|
|
159
112
|
metavar='<icmp-code>',
|
|
160
113
|
type=int,
|
|
161
|
-
help=
|
|
162
|
-
_("ICMP code for ICMP IP protocols")
|
|
163
|
-
),
|
|
114
|
+
help=_("ICMP code for ICMP IP protocols"),
|
|
164
115
|
)
|
|
165
116
|
direction_group = parser.add_mutually_exclusive_group()
|
|
166
117
|
direction_group.add_argument(
|
|
167
118
|
'--ingress',
|
|
168
119
|
action='store_true',
|
|
169
|
-
help=
|
|
170
|
-
_("Rule applies to incoming network traffic (default)")
|
|
171
|
-
),
|
|
120
|
+
help=_("Rule applies to incoming network traffic (default)"),
|
|
172
121
|
)
|
|
173
122
|
direction_group.add_argument(
|
|
174
123
|
'--egress',
|
|
175
124
|
action='store_true',
|
|
176
|
-
help=
|
|
177
|
-
_("Rule applies to outgoing network traffic")
|
|
178
|
-
),
|
|
125
|
+
help=_("Rule applies to outgoing network traffic"),
|
|
179
126
|
)
|
|
180
127
|
parser.add_argument(
|
|
181
128
|
'--ethertype',
|
|
182
129
|
metavar='<ethertype>',
|
|
183
130
|
choices=['IPv4', 'IPv6'],
|
|
184
131
|
type=network_utils.convert_ipvx_case,
|
|
185
|
-
help=
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
"(IPv4, IPv6; default: based on IP protocol)"
|
|
189
|
-
)
|
|
132
|
+
help=_(
|
|
133
|
+
"Ethertype of network traffic "
|
|
134
|
+
"(IPv4, IPv6; default: based on IP protocol)"
|
|
190
135
|
),
|
|
191
136
|
)
|
|
192
137
|
parser.add_argument(
|
|
193
138
|
'--project',
|
|
194
139
|
metavar='<project>',
|
|
195
|
-
help=
|
|
196
|
-
)
|
|
197
|
-
identity_common.add_project_domain_option_to_parser(
|
|
198
|
-
parser, enhance_help=self.enhance_help_neutron
|
|
140
|
+
help=_("Owner's project (name or ID)"),
|
|
199
141
|
)
|
|
142
|
+
identity_common.add_project_domain_option_to_parser(parser)
|
|
200
143
|
return parser
|
|
201
144
|
|
|
202
|
-
def
|
|
145
|
+
def take_action(
|
|
146
|
+
self, parsed_args: argparse.Namespace
|
|
147
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
148
|
+
client = self.app.client_manager.network
|
|
203
149
|
# Get the security group ID to hold the rule.
|
|
204
150
|
security_group_id = client.find_security_group(
|
|
205
151
|
parsed_args.group, ignore_missing=False
|
|
@@ -291,46 +237,12 @@ class CreateSecurityGroupRule(
|
|
|
291
237
|
data = utils.get_item_properties(obj, columns)
|
|
292
238
|
return (display_columns, data)
|
|
293
239
|
|
|
294
|
-
def take_action_compute(self, client, parsed_args):
|
|
295
|
-
group = compute_v2.find_security_group(client, parsed_args.group)
|
|
296
|
-
protocol = network_utils.get_protocol(
|
|
297
|
-
parsed_args, default_protocol='tcp'
|
|
298
|
-
)
|
|
299
|
-
if protocol == 'icmp':
|
|
300
|
-
from_port, to_port = -1, -1
|
|
301
|
-
else:
|
|
302
|
-
from_port, to_port = parsed_args.dst_port
|
|
303
240
|
|
|
304
|
-
|
|
305
|
-
if parsed_args.remote_group is not None:
|
|
306
|
-
parsed_args.remote_group = compute_v2.find_security_group(
|
|
307
|
-
client, parsed_args.remote_group
|
|
308
|
-
)['id']
|
|
309
|
-
if parsed_args.remote_ip is not None:
|
|
310
|
-
remote_ip = parsed_args.remote_ip
|
|
311
|
-
else:
|
|
312
|
-
remote_ip = '0.0.0.0/0'
|
|
313
|
-
|
|
314
|
-
obj = compute_v2.create_security_group_rule(
|
|
315
|
-
client,
|
|
316
|
-
security_group_id=group['id'],
|
|
317
|
-
ip_protocol=protocol,
|
|
318
|
-
from_port=from_port,
|
|
319
|
-
to_port=to_port,
|
|
320
|
-
remote_ip=remote_ip,
|
|
321
|
-
remote_group=parsed_args.remote_group,
|
|
322
|
-
)
|
|
323
|
-
return network_utils.format_security_group_rule_show(obj)
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
class DeleteSecurityGroupRule(common.NetworkAndComputeDelete):
|
|
241
|
+
class DeleteSecurityGroupRule(command.Command):
|
|
327
242
|
_description = _("Delete security group rule(s)")
|
|
328
243
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
r = None
|
|
332
|
-
|
|
333
|
-
def update_parser_common(self, parser):
|
|
244
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
245
|
+
parser = super().get_parser(prog_name)
|
|
334
246
|
parser.add_argument(
|
|
335
247
|
'rule',
|
|
336
248
|
metavar='<rule>',
|
|
@@ -339,131 +251,110 @@ class DeleteSecurityGroupRule(common.NetworkAndComputeDelete):
|
|
|
339
251
|
)
|
|
340
252
|
return parser
|
|
341
253
|
|
|
342
|
-
def
|
|
343
|
-
|
|
344
|
-
|
|
254
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
255
|
+
client = self.app.client_manager.network
|
|
256
|
+
result = 0
|
|
257
|
+
|
|
258
|
+
for rule in parsed_args.rule:
|
|
259
|
+
try:
|
|
260
|
+
obj = client.find_security_group_rule(
|
|
261
|
+
rule, ignore_missing=False
|
|
262
|
+
)
|
|
263
|
+
client.delete_security_group_rule(obj)
|
|
264
|
+
except Exception as e:
|
|
265
|
+
result += 1
|
|
266
|
+
LOG.error(
|
|
267
|
+
_(
|
|
268
|
+
"Failed to delete security group rule with "
|
|
269
|
+
"name or ID '%(rule)s': %(e)s"
|
|
270
|
+
),
|
|
271
|
+
{'rule': rule, 'e': e},
|
|
272
|
+
)
|
|
345
273
|
|
|
346
|
-
|
|
347
|
-
|
|
274
|
+
if result > 0:
|
|
275
|
+
total = len(parsed_args.rule)
|
|
276
|
+
msg = _("%(result)s of %(total)s rules failed to delete.") % {
|
|
277
|
+
'result': result,
|
|
278
|
+
'total': total,
|
|
279
|
+
}
|
|
280
|
+
raise exceptions.CommandError(msg)
|
|
348
281
|
|
|
349
282
|
|
|
350
|
-
class ListSecurityGroupRule(
|
|
283
|
+
class ListSecurityGroupRule(command.Lister):
|
|
351
284
|
_description = _("List security group rules")
|
|
352
285
|
|
|
353
|
-
|
|
286
|
+
@staticmethod
|
|
287
|
+
def _format_network_security_group_rule(
|
|
288
|
+
rule: _security_group_rule.SecurityGroupRule,
|
|
289
|
+
) -> dict[str, object]:
|
|
354
290
|
"""Transform the SDK SecurityGroupRule object to a dict
|
|
355
291
|
|
|
356
292
|
The SDK object gets in the way of reformatting columns...
|
|
357
293
|
Create port_range column from port_range_min and port_range_max
|
|
358
294
|
"""
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return
|
|
295
|
+
data = rule.to_dict()
|
|
296
|
+
data['port_range'] = network_utils.format_network_port_range(data)
|
|
297
|
+
data['remote_ip_prefix'] = network_utils.format_remote_ip_prefix(data)
|
|
298
|
+
return data
|
|
363
299
|
|
|
364
|
-
def
|
|
300
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
301
|
+
parser = super().get_parser(prog_name)
|
|
365
302
|
parser.add_argument(
|
|
366
303
|
'group',
|
|
367
304
|
metavar='<group>',
|
|
368
305
|
nargs='?',
|
|
369
306
|
help=_("List all rules in this security group (name or ID)"),
|
|
370
307
|
)
|
|
371
|
-
return parser
|
|
372
|
-
|
|
373
|
-
def update_parser_network(self, parser):
|
|
374
|
-
if not self.is_docs_build:
|
|
375
|
-
# Accept but hide the argument for consistency with compute.
|
|
376
|
-
# Network will always return all projects for an admin.
|
|
377
|
-
parser.add_argument(
|
|
378
|
-
'--all-projects',
|
|
379
|
-
action='store_true',
|
|
380
|
-
default=False,
|
|
381
|
-
help=argparse.SUPPRESS,
|
|
382
|
-
)
|
|
383
|
-
|
|
384
308
|
parser.add_argument(
|
|
385
309
|
'--protocol',
|
|
386
310
|
metavar='<protocol>',
|
|
387
311
|
type=network_utils.convert_to_lowercase,
|
|
388
|
-
help=
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
"representations [0-255] or any; "
|
|
396
|
-
"default: any (all protocols))"
|
|
397
|
-
)
|
|
312
|
+
help=_(
|
|
313
|
+
"List only rules with the specified IP protocol "
|
|
314
|
+
"(ah, dhcp, egp, esp, gre, icmp, igmp, ipv6-encap, "
|
|
315
|
+
"ipv6-frag, ipv6-icmp, ipv6-nonxt, ipv6-opts, ipv6-route, "
|
|
316
|
+
"ospf, pgm, rsvp, sctp, tcp, udp, udplite, vrrp and integer "
|
|
317
|
+
"representations [0-255] or any; "
|
|
318
|
+
"default: any (all protocols))"
|
|
398
319
|
),
|
|
399
320
|
)
|
|
400
321
|
parser.add_argument(
|
|
401
322
|
'--ethertype',
|
|
402
323
|
metavar='<ethertype>',
|
|
403
324
|
type=network_utils.convert_to_lowercase,
|
|
404
|
-
help=
|
|
405
|
-
|
|
406
|
-
"List only rules with the specified Ethertype "
|
|
407
|
-
"(IPv4 or IPv6)"
|
|
408
|
-
)
|
|
325
|
+
help=_(
|
|
326
|
+
"List only rules with the specified Ethertype (IPv4 or IPv6)"
|
|
409
327
|
),
|
|
410
328
|
)
|
|
411
329
|
direction_group = parser.add_mutually_exclusive_group()
|
|
412
330
|
direction_group.add_argument(
|
|
413
331
|
'--ingress',
|
|
414
332
|
action='store_true',
|
|
415
|
-
help=
|
|
416
|
-
_("List only rules applied to incoming network traffic")
|
|
417
|
-
),
|
|
333
|
+
help=_("List only rules applied to incoming network traffic"),
|
|
418
334
|
)
|
|
419
335
|
direction_group.add_argument(
|
|
420
336
|
'--egress',
|
|
421
337
|
action='store_true',
|
|
422
|
-
help=
|
|
423
|
-
_("List only rules applied to outgoing network traffic")
|
|
424
|
-
),
|
|
338
|
+
help=_("List only rules applied to outgoing network traffic"),
|
|
425
339
|
)
|
|
426
340
|
parser.add_argument(
|
|
427
341
|
'--long',
|
|
428
342
|
action='store_true',
|
|
429
343
|
default=False,
|
|
430
|
-
help=
|
|
431
|
-
_("**Deprecated** This argument is no longer needed")
|
|
432
|
-
),
|
|
344
|
+
help=_("**Deprecated** This argument is no longer needed"),
|
|
433
345
|
)
|
|
434
346
|
parser.add_argument(
|
|
435
347
|
'--project',
|
|
436
348
|
metavar='<project>',
|
|
437
|
-
help=
|
|
438
|
-
_("List only rules with the specified project (name or ID)")
|
|
439
|
-
),
|
|
440
|
-
)
|
|
441
|
-
identity_common.add_project_domain_option_to_parser(
|
|
442
|
-
parser, enhance_help=self.enhance_help_neutron
|
|
443
|
-
)
|
|
444
|
-
return parser
|
|
445
|
-
|
|
446
|
-
def update_parser_compute(self, parser):
|
|
447
|
-
parser.add_argument(
|
|
448
|
-
'--all-projects',
|
|
449
|
-
action='store_true',
|
|
450
|
-
default=False,
|
|
451
|
-
help=self.enhance_help_nova_network(
|
|
452
|
-
_("Display information from all projects (admin only)")
|
|
453
|
-
),
|
|
349
|
+
help=_("List only rules with the specified project (name or ID)"),
|
|
454
350
|
)
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
# There are no additional fields to display at this time.
|
|
458
|
-
parser.add_argument(
|
|
459
|
-
'--long',
|
|
460
|
-
action='store_false',
|
|
461
|
-
default=False,
|
|
462
|
-
help=argparse.SUPPRESS,
|
|
463
|
-
)
|
|
351
|
+
identity_common.add_project_domain_option_to_parser(parser)
|
|
352
|
+
pagination.add_marker_pagination_option_to_parser(parser)
|
|
464
353
|
return parser
|
|
465
354
|
|
|
466
|
-
def _get_column_headers(
|
|
355
|
+
def _get_column_headers(
|
|
356
|
+
self, parsed_args: argparse.Namespace
|
|
357
|
+
) -> tuple[str, ...]:
|
|
467
358
|
column_headers: tuple[str, ...] = (
|
|
468
359
|
'ID',
|
|
469
360
|
'IP Protocol',
|
|
@@ -472,14 +363,16 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
|
|
|
472
363
|
'Port Range',
|
|
473
364
|
'Direction',
|
|
474
365
|
'Remote Security Group',
|
|
366
|
+
'Remote Address Group',
|
|
475
367
|
)
|
|
476
|
-
if self.is_neutron:
|
|
477
|
-
column_headers += ('Remote Address Group',)
|
|
478
368
|
if parsed_args.group is None:
|
|
479
369
|
column_headers += ('Security Group',)
|
|
480
370
|
return column_headers
|
|
481
371
|
|
|
482
|
-
def
|
|
372
|
+
def take_action(
|
|
373
|
+
self, parsed_args: argparse.Namespace
|
|
374
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
375
|
+
client = self.app.client_manager.network
|
|
483
376
|
if parsed_args.long:
|
|
484
377
|
msg = _(
|
|
485
378
|
"The --long option has been deprecated and is no longer needed"
|
|
@@ -524,9 +417,15 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
|
|
|
524
417
|
parsed_args.project,
|
|
525
418
|
parsed_args.project_domain,
|
|
526
419
|
).id
|
|
527
|
-
query['tenant_id'] = project_id
|
|
528
420
|
query['project_id'] = project_id
|
|
529
421
|
|
|
422
|
+
if parsed_args.marker is not None:
|
|
423
|
+
query['marker'] = parsed_args.marker
|
|
424
|
+
if parsed_args.limit is not None:
|
|
425
|
+
query['limit'] = parsed_args.limit
|
|
426
|
+
if parsed_args.max_items is not None:
|
|
427
|
+
query['max_items'] = parsed_args.max_items
|
|
428
|
+
|
|
530
429
|
rules = [
|
|
531
430
|
self._format_network_security_group_rule(r)
|
|
532
431
|
for r in client.security_group_rules(**query)
|
|
@@ -543,57 +442,12 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
|
|
|
543
442
|
),
|
|
544
443
|
)
|
|
545
444
|
|
|
546
|
-
def take_action_compute(self, client, parsed_args):
|
|
547
|
-
column_headers = self._get_column_headers(parsed_args)
|
|
548
|
-
columns: tuple[str, ...] = (
|
|
549
|
-
"ID",
|
|
550
|
-
"IP Protocol",
|
|
551
|
-
"Ethertype",
|
|
552
|
-
"IP Range",
|
|
553
|
-
"Port Range",
|
|
554
|
-
"Remote Security Group",
|
|
555
|
-
)
|
|
556
445
|
|
|
557
|
-
|
|
558
|
-
if parsed_args.group is not None:
|
|
559
|
-
security_group = compute_v2.find_security_group(
|
|
560
|
-
client, parsed_args.group
|
|
561
|
-
)
|
|
562
|
-
rules_to_list = security_group['rules']
|
|
563
|
-
else:
|
|
564
|
-
columns += ('parent_group_id',)
|
|
565
|
-
for security_group in compute_v2.list_security_groups(
|
|
566
|
-
client, all_projects=parsed_args.all_projects
|
|
567
|
-
):
|
|
568
|
-
rules_to_list.extend(security_group['rules'])
|
|
569
|
-
|
|
570
|
-
# NOTE(rtheis): Turn the raw rules into resources.
|
|
571
|
-
rules = []
|
|
572
|
-
for rule in rules_to_list:
|
|
573
|
-
rules.append(
|
|
574
|
-
network_utils.transform_compute_security_group_rule(rule),
|
|
575
|
-
)
|
|
576
|
-
# rules.append(compute_secgroup_rules.SecurityGroupRule(
|
|
577
|
-
# client.security_group_rules,
|
|
578
|
-
# network_utils.transform_compute_security_group_rule(rule),
|
|
579
|
-
# ))
|
|
580
|
-
|
|
581
|
-
return (
|
|
582
|
-
column_headers,
|
|
583
|
-
(
|
|
584
|
-
utils.get_dict_properties(
|
|
585
|
-
s,
|
|
586
|
-
columns,
|
|
587
|
-
)
|
|
588
|
-
for s in rules
|
|
589
|
-
),
|
|
590
|
-
)
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
class ShowSecurityGroupRule(common.NetworkAndComputeShowOne):
|
|
446
|
+
class ShowSecurityGroupRule(command.ShowOne):
|
|
594
447
|
_description = _("Display security group rule details")
|
|
595
448
|
|
|
596
|
-
def
|
|
449
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
450
|
+
parser = super().get_parser(prog_name)
|
|
597
451
|
parser.add_argument(
|
|
598
452
|
'rule',
|
|
599
453
|
metavar="<rule>",
|
|
@@ -601,7 +455,10 @@ class ShowSecurityGroupRule(common.NetworkAndComputeShowOne):
|
|
|
601
455
|
)
|
|
602
456
|
return parser
|
|
603
457
|
|
|
604
|
-
def
|
|
458
|
+
def take_action(
|
|
459
|
+
self, parsed_args: argparse.Namespace
|
|
460
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
461
|
+
client = self.app.client_manager.network
|
|
605
462
|
obj = client.find_security_group_rule(
|
|
606
463
|
parsed_args.rule, ignore_missing=False
|
|
607
464
|
)
|
|
@@ -613,27 +470,3 @@ class ShowSecurityGroupRule(common.NetworkAndComputeShowOne):
|
|
|
613
470
|
display_columns, columns = _get_columns(obj)
|
|
614
471
|
data = utils.get_item_properties(obj, columns)
|
|
615
472
|
return (display_columns, data)
|
|
616
|
-
|
|
617
|
-
def take_action_compute(self, client, parsed_args):
|
|
618
|
-
# NOTE(rtheis): Unfortunately, compute does not have an API
|
|
619
|
-
# to get or list security group rules so parse through the
|
|
620
|
-
# security groups to find all accessible rules in search of
|
|
621
|
-
# the requested rule.
|
|
622
|
-
obj = None
|
|
623
|
-
security_group_rules = []
|
|
624
|
-
for security_group in compute_v2.list_security_groups(client):
|
|
625
|
-
security_group_rules.extend(security_group['rules'])
|
|
626
|
-
for security_group_rule in security_group_rules:
|
|
627
|
-
if parsed_args.rule == str(security_group_rule.get('id')):
|
|
628
|
-
obj = security_group_rule
|
|
629
|
-
break
|
|
630
|
-
|
|
631
|
-
if obj is None:
|
|
632
|
-
msg = (
|
|
633
|
-
_("Could not find security group rule with ID '%s'")
|
|
634
|
-
% parsed_args.rule
|
|
635
|
-
)
|
|
636
|
-
raise exceptions.CommandError(msg)
|
|
637
|
-
|
|
638
|
-
# NOTE(rtheis): Format security group rule
|
|
639
|
-
return network_utils.format_security_group_rule_show(obj)
|