python-openstackclient 8.1.0__py3-none-any.whl → 8.3.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/api/compute_v2.py +2 -2
- openstackclient/api/object_store_v1.py +4 -1
- openstackclient/api/volume_v2.py +60 -0
- openstackclient/api/volume_v3.py +60 -0
- openstackclient/command.py +27 -0
- openstackclient/common/availability_zone.py +1 -1
- openstackclient/common/clientmanager.py +59 -21
- openstackclient/common/configuration.py +1 -1
- openstackclient/common/extension.py +1 -1
- openstackclient/common/limits.py +1 -1
- openstackclient/common/module.py +4 -2
- openstackclient/common/project_cleanup.py +10 -8
- openstackclient/common/quota.py +23 -6
- openstackclient/common/versions.py +1 -2
- openstackclient/compute/v2/agent.py +1 -1
- openstackclient/compute/v2/aggregate.py +6 -5
- openstackclient/compute/v2/console.py +5 -3
- openstackclient/compute/v2/console_connection.py +1 -1
- openstackclient/compute/v2/flavor.py +15 -2
- openstackclient/compute/v2/host.py +1 -1
- openstackclient/compute/v2/hypervisor.py +1 -1
- openstackclient/compute/v2/hypervisor_stats.py +1 -1
- openstackclient/compute/v2/keypair.py +1 -1
- openstackclient/compute/v2/server.py +77 -30
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_event.py +1 -1
- openstackclient/compute/v2/server_group.py +4 -2
- openstackclient/compute/v2/server_image.py +1 -1
- openstackclient/compute/v2/server_migration.py +1 -1
- openstackclient/compute/v2/server_volume.py +1 -1
- openstackclient/compute/v2/service.py +1 -1
- openstackclient/compute/v2/usage.py +6 -4
- openstackclient/identity/common.py +10 -14
- openstackclient/identity/v2_0/catalog.py +3 -2
- openstackclient/identity/v2_0/ec2creds.py +1 -1
- openstackclient/identity/v2_0/endpoint.py +1 -1
- openstackclient/identity/v2_0/project.py +17 -7
- openstackclient/identity/v2_0/role.py +1 -1
- openstackclient/identity/v2_0/role_assignment.py +3 -3
- openstackclient/identity/v2_0/service.py +1 -1
- openstackclient/identity/v2_0/token.py +1 -1
- openstackclient/identity/v2_0/user.py +2 -2
- openstackclient/identity/v3/access_rule.py +16 -4
- openstackclient/identity/v3/application_credential.py +116 -95
- openstackclient/identity/v3/catalog.py +3 -3
- openstackclient/identity/v3/consumer.py +1 -1
- openstackclient/identity/v3/credential.py +1 -1
- openstackclient/identity/v3/domain.py +15 -10
- openstackclient/identity/v3/ec2creds.py +1 -1
- openstackclient/identity/v3/endpoint.py +33 -12
- openstackclient/identity/v3/endpoint_group.py +1 -1
- openstackclient/identity/v3/federation_protocol.py +1 -1
- openstackclient/identity/v3/group.py +11 -5
- openstackclient/identity/v3/identity_provider.py +12 -10
- openstackclient/identity/v3/implied_role.py +1 -1
- openstackclient/identity/v3/limit.py +1 -1
- openstackclient/identity/v3/mapping.py +1 -1
- openstackclient/identity/v3/policy.py +1 -1
- openstackclient/identity/v3/project.py +34 -22
- openstackclient/identity/v3/region.py +1 -1
- openstackclient/identity/v3/registered_limit.py +16 -11
- openstackclient/identity/v3/role.py +27 -41
- openstackclient/identity/v3/role_assignment.py +12 -23
- openstackclient/identity/v3/service.py +1 -1
- openstackclient/identity/v3/service_provider.py +1 -1
- openstackclient/identity/v3/tag.py +3 -2
- openstackclient/identity/v3/token.py +3 -2
- openstackclient/identity/v3/trust.py +4 -2
- openstackclient/identity/v3/unscoped_saml.py +1 -1
- openstackclient/identity/v3/user.py +22 -13
- openstackclient/image/v1/image.py +35 -17
- openstackclient/image/v2/cache.py +11 -7
- openstackclient/image/v2/image.py +62 -12
- openstackclient/image/v2/info.py +1 -1
- openstackclient/image/v2/metadef_namespaces.py +1 -1
- openstackclient/image/v2/metadef_objects.py +9 -3
- openstackclient/image/v2/metadef_properties.py +11 -3
- openstackclient/image/v2/metadef_resource_type_association.py +1 -1
- openstackclient/image/v2/metadef_resource_types.py +1 -1
- openstackclient/image/v2/task.py +1 -1
- openstackclient/network/common.py +10 -9
- openstackclient/network/v2/address_group.py +4 -3
- openstackclient/network/v2/address_scope.py +8 -6
- openstackclient/network/v2/default_security_group_rule.py +9 -8
- openstackclient/network/v2/floating_ip.py +16 -9
- openstackclient/network/v2/floating_ip_port_forwarding.py +9 -6
- openstackclient/network/v2/ip_availability.py +7 -4
- openstackclient/network/v2/l3_conntrack_helper.py +11 -4
- openstackclient/network/v2/local_ip.py +13 -7
- openstackclient/network/v2/local_ip_association.py +7 -4
- openstackclient/network/v2/ndp_proxy.py +13 -6
- openstackclient/network/v2/network.py +33 -16
- openstackclient/network/v2/network_agent.py +5 -5
- openstackclient/network/v2/network_auto_allocated_topology.py +1 -1
- openstackclient/network/v2/network_flavor.py +1 -1
- openstackclient/network/v2/network_flavor_profile.py +1 -1
- openstackclient/network/v2/network_meter.py +1 -1
- openstackclient/network/v2/network_meter_rule.py +1 -1
- openstackclient/network/v2/network_qos_policy.py +7 -5
- openstackclient/network/v2/network_qos_rule.py +1 -1
- openstackclient/network/v2/network_qos_rule_type.py +1 -1
- openstackclient/network/v2/network_rbac.py +8 -5
- openstackclient/network/v2/network_segment.py +2 -2
- openstackclient/network/v2/network_segment_range.py +13 -6
- openstackclient/network/v2/network_service_provider.py +1 -1
- openstackclient/network/v2/network_trunk.py +65 -42
- openstackclient/network/v2/port.py +38 -20
- openstackclient/network/v2/router.py +19 -8
- openstackclient/network/v2/security_group.py +52 -7
- openstackclient/network/v2/security_group_rule.py +27 -4
- openstackclient/network/v2/subnet.py +17 -18
- openstackclient/network/v2/subnet_pool.py +11 -9
- openstackclient/network/v2/taas/__init__.py +0 -0
- openstackclient/network/v2/taas/tap_flow.py +245 -0
- openstackclient/network/v2/taas/tap_mirror.py +237 -0
- openstackclient/network/v2/taas/tap_service.py +211 -0
- openstackclient/object/v1/account.py +1 -1
- openstackclient/object/v1/container.py +1 -1
- openstackclient/object/v1/object.py +1 -1
- openstackclient/shell.py +18 -8
- openstackclient/tests/functional/identity/v3/test_access_rule.py +1 -1
- openstackclient/tests/functional/identity/v3/test_application_credential.py +7 -7
- openstackclient/tests/functional/identity/v3/test_catalog.py +42 -23
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +174 -0
- openstackclient/tests/functional/image/v2/test_cache.py +54 -0
- openstackclient/tests/functional/image/v2/test_image.py +36 -14
- openstackclient/tests/functional/image/v2/test_metadef_resource_type.py +55 -0
- openstackclient/tests/functional/volume/v2/test_volume.py +1 -1
- openstackclient/tests/functional/volume/v3/test_volume.py +2 -2
- openstackclient/tests/unit/api/test_volume_v2.py +124 -0
- openstackclient/tests/unit/api/test_volume_v3.py +124 -0
- openstackclient/tests/unit/common/test_command.py +1 -1
- openstackclient/tests/unit/common/test_extension.py +2 -3
- openstackclient/tests/unit/common/test_module.py +14 -7
- openstackclient/tests/unit/common/test_quota.py +20 -0
- openstackclient/tests/unit/compute/v2/test_aggregate.py +5 -3
- openstackclient/tests/unit/compute/v2/test_console.py +1 -4
- openstackclient/tests/unit/compute/v2/test_flavor.py +160 -177
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -9
- openstackclient/tests/unit/compute/v2/test_server.py +406 -81
- openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -3
- openstackclient/tests/unit/compute/v2/test_service.py +1 -3
- openstackclient/tests/unit/fakes.py +35 -134
- openstackclient/tests/unit/identity/test_common.py +100 -0
- openstackclient/tests/unit/identity/v2_0/test_project.py +4 -4
- openstackclient/tests/unit/identity/v3/fakes.py +10 -2
- openstackclient/tests/unit/identity/v3/test_application_credential.py +50 -44
- openstackclient/tests/unit/identity/v3/test_domain.py +3 -3
- openstackclient/tests/unit/identity/v3/test_endpoint.py +1 -1
- openstackclient/tests/unit/identity/v3/test_group.py +4 -2
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +10 -10
- openstackclient/tests/unit/identity/v3/test_oauth.py +1 -1
- openstackclient/tests/unit/identity/v3/test_project.py +31 -54
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +2 -2
- openstackclient/tests/unit/identity/v3/test_role.py +3 -90
- openstackclient/tests/unit/identity/v3/test_user.py +7 -51
- openstackclient/tests/unit/image/v1/test_image.py +47 -0
- openstackclient/tests/unit/image/v2/test_image.py +190 -9
- openstackclient/tests/unit/image/v2/test_metadef_objects.py +22 -0
- openstackclient/tests/unit/image/v2/test_metadef_properties.py +24 -10
- openstackclient/tests/unit/network/test_common.py +9 -13
- openstackclient/tests/unit/network/v2/fakes.py +1 -0
- openstackclient/tests/unit/network/v2/taas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_flow.py +276 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_mirror.py +288 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_service.py +271 -0
- openstackclient/tests/unit/network/v2/test_address_group.py +19 -22
- openstackclient/tests/unit/network/v2/test_address_scope.py +10 -15
- openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +38 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +21 -27
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +21 -18
- openstackclient/tests/unit/network/v2/test_ip_availability.py +6 -8
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +6 -15
- openstackclient/tests/unit/network/v2/test_local_ip.py +12 -23
- openstackclient/tests/unit/network/v2/test_local_ip_association.py +13 -18
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +13 -23
- openstackclient/tests/unit/network/v2/test_network.py +41 -37
- openstackclient/tests/unit/network/v2/test_network_agent.py +13 -20
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +5 -8
- openstackclient/tests/unit/network/v2/test_network_flavor.py +14 -26
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +14 -17
- openstackclient/tests/unit/network/v2/test_network_meter.py +7 -17
- openstackclient/tests/unit/network/v2/test_network_meter_rule.py +10 -20
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +7 -13
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +44 -54
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +2 -7
- openstackclient/tests/unit/network/v2/test_network_rbac.py +21 -36
- openstackclient/tests/unit/network/v2/test_network_segment.py +13 -29
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +20 -19
- openstackclient/tests/unit/network/v2/test_network_service_provider.py +1 -4
- openstackclient/tests/unit/network/v2/test_network_trunk.py +52 -47
- openstackclient/tests/unit/network/v2/test_port.py +113 -84
- openstackclient/tests/unit/network/v2/test_router.py +104 -126
- openstackclient/tests/unit/network/v2/test_security_group_network.py +25 -26
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +66 -18
- openstackclient/tests/unit/network/v2/test_subnet.py +35 -46
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +21 -33
- openstackclient/tests/unit/volume/test_find_resource.py +4 -13
- openstackclient/tests/unit/volume/v2/test_volume.py +358 -305
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +3 -1
- openstackclient/tests/unit/volume/v3/test_volume.py +443 -415
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +9 -0
- openstackclient/volume/client.py +7 -17
- openstackclient/volume/v2/backup_record.py +1 -1
- openstackclient/volume/v2/consistency_group.py +1 -1
- openstackclient/volume/v2/consistency_group_snapshot.py +1 -1
- openstackclient/volume/v2/qos_specs.py +1 -1
- openstackclient/volume/v2/service.py +2 -2
- openstackclient/volume/v2/volume.py +80 -54
- openstackclient/volume/v2/volume_backend.py +1 -1
- openstackclient/volume/v2/volume_backup.py +5 -3
- openstackclient/volume/v2/volume_host.py +1 -2
- openstackclient/volume/v2/volume_snapshot.py +2 -2
- openstackclient/volume/v2/volume_transfer_request.py +1 -1
- openstackclient/volume/v2/volume_type.py +11 -6
- openstackclient/volume/v3/block_storage_cleanup.py +1 -1
- openstackclient/volume/v3/block_storage_cluster.py +1 -1
- openstackclient/volume/v3/block_storage_log_level.py +1 -1
- openstackclient/volume/v3/block_storage_manage.py +1 -1
- openstackclient/volume/v3/block_storage_resource_filter.py +1 -1
- openstackclient/volume/v3/service.py +2 -2
- openstackclient/volume/v3/volume.py +104 -77
- openstackclient/volume/v3/volume_attachment.py +6 -5
- openstackclient/volume/v3/volume_backup.py +18 -3
- openstackclient/volume/v3/volume_group.py +2 -2
- openstackclient/volume/v3/volume_group_snapshot.py +1 -1
- openstackclient/volume/v3/volume_group_type.py +1 -1
- openstackclient/volume/v3/volume_message.py +1 -1
- openstackclient/volume/v3/volume_snapshot.py +2 -2
- openstackclient/volume/v3/volume_transfer_request.py +1 -1
- openstackclient/volume/v3/volume_type.py +15 -9
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/METADATA +19 -17
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/RECORD +239 -224
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/entry_points.txt +15 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info/licenses}/AUTHORS +15 -0
- python_openstackclient-8.3.0.dist-info/pbr.json +1 -0
- openstackclient/tests/unit/common/test_logs.py +0 -221
- python_openstackclient-8.1.0.dist-info/pbr.json +0 -1
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info/licenses}/LICENSE +0 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/top_level.txt +0 -0
|
@@ -20,17 +20,17 @@ import logging
|
|
|
20
20
|
|
|
21
21
|
from cliff import columns as cliff_columns
|
|
22
22
|
from keystoneauth1 import exceptions as ks_exc
|
|
23
|
-
from osc_lib.command import command
|
|
24
23
|
from osc_lib import exceptions
|
|
25
24
|
from osc_lib import utils
|
|
26
25
|
|
|
26
|
+
from openstackclient import command
|
|
27
27
|
from openstackclient.i18n import _
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
LOG = logging.getLogger(__name__)
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
class ProjectColumn(cliff_columns.FormattableColumn):
|
|
33
|
+
class ProjectColumn(cliff_columns.FormattableColumn[str]):
|
|
34
34
|
"""Formattable column for project column.
|
|
35
35
|
|
|
36
36
|
Unlike the parent FormattableColumn class, the initializer of the
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
import logging
|
|
19
19
|
|
|
20
|
-
from osc_lib.command import command
|
|
21
20
|
from osc_lib import exceptions
|
|
22
21
|
from osc_lib import utils
|
|
23
22
|
|
|
23
|
+
from openstackclient import command
|
|
24
24
|
from openstackclient.i18n import _
|
|
25
25
|
from openstackclient.identity import common
|
|
26
26
|
|
|
@@ -44,7 +44,11 @@ class DeleteAccessRule(command.Command):
|
|
|
44
44
|
def take_action(self, parsed_args):
|
|
45
45
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
46
46
|
conn = self.app.client_manager.sdk_connection
|
|
47
|
-
|
|
47
|
+
auth = conn.config.get_auth()
|
|
48
|
+
if auth is None:
|
|
49
|
+
# this will never happen
|
|
50
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
51
|
+
user_id = auth.get_user_id(conn.identity)
|
|
48
52
|
|
|
49
53
|
errors = 0
|
|
50
54
|
for ac in parsed_args.access_rule:
|
|
@@ -87,7 +91,11 @@ class ListAccessRule(command.Lister):
|
|
|
87
91
|
).id
|
|
88
92
|
else:
|
|
89
93
|
conn = self.app.client_manager.sdk_connection
|
|
90
|
-
|
|
94
|
+
auth = conn.config.get_auth()
|
|
95
|
+
if auth is None:
|
|
96
|
+
# this will never happen
|
|
97
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
98
|
+
user_id = auth.get_user_id(conn.identity)
|
|
91
99
|
|
|
92
100
|
columns = ('ID', 'Service', 'Method', 'Path')
|
|
93
101
|
data = identity_client.access_rules(user=user_id)
|
|
@@ -119,7 +127,11 @@ class ShowAccessRule(command.ShowOne):
|
|
|
119
127
|
def take_action(self, parsed_args):
|
|
120
128
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
121
129
|
conn = self.app.client_manager.sdk_connection
|
|
122
|
-
|
|
130
|
+
auth = conn.config.get_auth()
|
|
131
|
+
if auth is None:
|
|
132
|
+
# this will never happen
|
|
133
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
134
|
+
user_id = auth.get_user_id(conn.identity)
|
|
123
135
|
|
|
124
136
|
access_rule = identity_client.get_access_rule(
|
|
125
137
|
user_id, parsed_args.access_rule
|
|
@@ -18,19 +18,95 @@
|
|
|
18
18
|
import datetime
|
|
19
19
|
import json
|
|
20
20
|
import logging
|
|
21
|
+
import typing as ty
|
|
21
22
|
import uuid
|
|
22
23
|
|
|
23
|
-
from
|
|
24
|
+
from cliff import columns as cliff_columns
|
|
24
25
|
from osc_lib import exceptions
|
|
25
26
|
from osc_lib import utils
|
|
26
27
|
|
|
28
|
+
from openstackclient import command
|
|
27
29
|
from openstackclient.i18n import _
|
|
28
30
|
from openstackclient.identity import common
|
|
29
31
|
|
|
30
|
-
|
|
31
32
|
LOG = logging.getLogger(__name__)
|
|
32
33
|
|
|
33
34
|
|
|
35
|
+
class RolesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
|
36
|
+
"""Generate a formatted string of role names."""
|
|
37
|
+
|
|
38
|
+
def human_readable(self):
|
|
39
|
+
return utils.format_list(list(r['name'] for r in self._value))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _format_application_credential(
|
|
43
|
+
application_credential, *, include_secret=False
|
|
44
|
+
):
|
|
45
|
+
column_headers: tuple[str, ...] = (
|
|
46
|
+
'ID',
|
|
47
|
+
'Name',
|
|
48
|
+
'Description',
|
|
49
|
+
'Project ID',
|
|
50
|
+
'Roles',
|
|
51
|
+
'Unrestricted',
|
|
52
|
+
'Access Rules',
|
|
53
|
+
'Expires At',
|
|
54
|
+
)
|
|
55
|
+
columns: tuple[str, ...] = (
|
|
56
|
+
'id',
|
|
57
|
+
'name',
|
|
58
|
+
'description',
|
|
59
|
+
'project_id',
|
|
60
|
+
'roles',
|
|
61
|
+
'unrestricted',
|
|
62
|
+
'access_rules',
|
|
63
|
+
'expires_at',
|
|
64
|
+
)
|
|
65
|
+
if include_secret:
|
|
66
|
+
column_headers += ('Secret',)
|
|
67
|
+
columns += ('secret',)
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
column_headers,
|
|
71
|
+
utils.get_item_properties(
|
|
72
|
+
application_credential, columns, formatters={'roles': RolesColumn}
|
|
73
|
+
),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _format_application_credentials(application_credentials):
|
|
78
|
+
column_headers = (
|
|
79
|
+
'ID',
|
|
80
|
+
'Name',
|
|
81
|
+
'Description',
|
|
82
|
+
'Project ID',
|
|
83
|
+
'Roles',
|
|
84
|
+
'Unrestricted',
|
|
85
|
+
'Access Rules',
|
|
86
|
+
'Expires At',
|
|
87
|
+
)
|
|
88
|
+
columns = (
|
|
89
|
+
'id',
|
|
90
|
+
'name',
|
|
91
|
+
'description',
|
|
92
|
+
'project_id',
|
|
93
|
+
'roles',
|
|
94
|
+
'unrestricted',
|
|
95
|
+
'access_rules',
|
|
96
|
+
'expires_at',
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
column_headers,
|
|
101
|
+
(
|
|
102
|
+
utils.get_item_properties(
|
|
103
|
+
x, columns, formatters={'roles': RolesColumn}
|
|
104
|
+
)
|
|
105
|
+
for x in application_credentials
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
34
110
|
# TODO(stephenfin): Move this to osc_lib since it's useful elsewhere
|
|
35
111
|
def is_uuid_like(value) -> bool:
|
|
36
112
|
"""Returns validation of a value as a UUID.
|
|
@@ -38,9 +114,6 @@ def is_uuid_like(value) -> bool:
|
|
|
38
114
|
:param val: Value to verify
|
|
39
115
|
:type val: string
|
|
40
116
|
:returns: bool
|
|
41
|
-
|
|
42
|
-
.. versionchanged:: 1.1.1
|
|
43
|
-
Support non-lowercase UUIDs.
|
|
44
117
|
"""
|
|
45
118
|
try:
|
|
46
119
|
formatted_value = (
|
|
@@ -76,6 +149,7 @@ class CreateApplicationCredential(command.ShowOne):
|
|
|
76
149
|
parser.add_argument(
|
|
77
150
|
'--role',
|
|
78
151
|
metavar='<role>',
|
|
152
|
+
dest='roles',
|
|
79
153
|
action='append',
|
|
80
154
|
default=[],
|
|
81
155
|
help=_(
|
|
@@ -132,10 +206,15 @@ class CreateApplicationCredential(command.ShowOne):
|
|
|
132
206
|
def take_action(self, parsed_args):
|
|
133
207
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
134
208
|
conn = self.app.client_manager.sdk_connection
|
|
135
|
-
|
|
209
|
+
auth = conn.config.get_auth()
|
|
210
|
+
if auth is None:
|
|
211
|
+
# this will never happen
|
|
212
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
213
|
+
|
|
214
|
+
user_id = auth.get_user_id(conn.identity)
|
|
136
215
|
|
|
137
216
|
role_ids = []
|
|
138
|
-
for role in parsed_args.
|
|
217
|
+
for role in parsed_args.roles:
|
|
139
218
|
if is_uuid_like(role):
|
|
140
219
|
role_ids.append({'id': role})
|
|
141
220
|
else:
|
|
@@ -179,31 +258,8 @@ class CreateApplicationCredential(command.ShowOne):
|
|
|
179
258
|
access_rules=access_rules,
|
|
180
259
|
)
|
|
181
260
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
roles = application_credential['roles']
|
|
185
|
-
msg = ' '.join(r['name'] for r in roles)
|
|
186
|
-
application_credential['roles'] = msg
|
|
187
|
-
|
|
188
|
-
columns = (
|
|
189
|
-
'id',
|
|
190
|
-
'name',
|
|
191
|
-
'description',
|
|
192
|
-
'project_id',
|
|
193
|
-
'roles',
|
|
194
|
-
'unrestricted',
|
|
195
|
-
'access_rules',
|
|
196
|
-
'expires_at',
|
|
197
|
-
'secret',
|
|
198
|
-
)
|
|
199
|
-
return (
|
|
200
|
-
columns,
|
|
201
|
-
(
|
|
202
|
-
utils.get_dict_properties(
|
|
203
|
-
application_credential,
|
|
204
|
-
columns,
|
|
205
|
-
)
|
|
206
|
-
),
|
|
261
|
+
return _format_application_credential(
|
|
262
|
+
application_credential, include_secret=True
|
|
207
263
|
)
|
|
208
264
|
|
|
209
265
|
|
|
@@ -223,13 +279,18 @@ class DeleteApplicationCredential(command.Command):
|
|
|
223
279
|
def take_action(self, parsed_args):
|
|
224
280
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
225
281
|
conn = self.app.client_manager.sdk_connection
|
|
226
|
-
|
|
282
|
+
auth = conn.config.get_auth()
|
|
283
|
+
if auth is None:
|
|
284
|
+
# this will never happen
|
|
285
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
286
|
+
|
|
287
|
+
user_id = auth.get_user_id(conn.identity)
|
|
227
288
|
|
|
228
289
|
errors = 0
|
|
229
290
|
for ac in parsed_args.application_credential:
|
|
230
291
|
try:
|
|
231
292
|
app_cred = identity_client.find_application_credential(
|
|
232
|
-
user_id, ac
|
|
293
|
+
user_id, ac, ignore_missing=False
|
|
233
294
|
)
|
|
234
295
|
identity_client.delete_application_credential(
|
|
235
296
|
user_id, app_cred.id
|
|
@@ -252,6 +313,8 @@ class DeleteApplicationCredential(command.Command):
|
|
|
252
313
|
) % {'errors': errors, 'total': total}
|
|
253
314
|
raise exceptions.CommandError(msg)
|
|
254
315
|
|
|
316
|
+
return None
|
|
317
|
+
|
|
255
318
|
|
|
256
319
|
class ListApplicationCredential(command.Lister):
|
|
257
320
|
_description = _("List application credentials")
|
|
@@ -274,41 +337,18 @@ class ListApplicationCredential(command.Lister):
|
|
|
274
337
|
)
|
|
275
338
|
else:
|
|
276
339
|
conn = self.app.client_manager.sdk_connection
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
msg = ' '.join(r['name'] for r in roles)
|
|
286
|
-
ac['roles'] = msg
|
|
287
|
-
|
|
288
|
-
data_formatted.append(ac)
|
|
289
|
-
|
|
290
|
-
columns = (
|
|
291
|
-
'ID',
|
|
292
|
-
'Name',
|
|
293
|
-
'Description',
|
|
294
|
-
'Project ID',
|
|
295
|
-
'Roles',
|
|
296
|
-
'Unrestricted',
|
|
297
|
-
'Access Rules',
|
|
298
|
-
'Expires At',
|
|
299
|
-
)
|
|
300
|
-
return (
|
|
301
|
-
columns,
|
|
302
|
-
(
|
|
303
|
-
utils.get_item_properties(
|
|
304
|
-
s,
|
|
305
|
-
columns,
|
|
306
|
-
formatters={},
|
|
307
|
-
)
|
|
308
|
-
for s in data_formatted
|
|
309
|
-
),
|
|
340
|
+
auth = conn.config.get_auth()
|
|
341
|
+
if auth is None:
|
|
342
|
+
# this will never happen
|
|
343
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
344
|
+
user_id = auth.get_user_id(conn.identity)
|
|
345
|
+
|
|
346
|
+
application_credentials = identity_client.application_credentials(
|
|
347
|
+
user=user_id
|
|
310
348
|
)
|
|
311
349
|
|
|
350
|
+
return _format_application_credentials(application_credentials)
|
|
351
|
+
|
|
312
352
|
|
|
313
353
|
class ShowApplicationCredential(command.ShowOne):
|
|
314
354
|
_description = _("Display application credential details")
|
|
@@ -325,33 +365,14 @@ class ShowApplicationCredential(command.ShowOne):
|
|
|
325
365
|
def take_action(self, parsed_args):
|
|
326
366
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
327
367
|
conn = self.app.client_manager.sdk_connection
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
368
|
+
auth = conn.config.get_auth()
|
|
369
|
+
if auth is None:
|
|
370
|
+
# this will never happen
|
|
371
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
372
|
+
user_id = auth.get_user_id(conn.identity)
|
|
373
|
+
|
|
374
|
+
application_credential = identity_client.find_application_credential(
|
|
375
|
+
user_id, parsed_args.application_credential, ignore_missing=False
|
|
332
376
|
)
|
|
333
377
|
|
|
334
|
-
|
|
335
|
-
roles = app_cred['roles']
|
|
336
|
-
msg = ' '.join(r['name'] for r in roles)
|
|
337
|
-
app_cred['roles'] = msg
|
|
338
|
-
|
|
339
|
-
columns = (
|
|
340
|
-
'id',
|
|
341
|
-
'name',
|
|
342
|
-
'description',
|
|
343
|
-
'project_id',
|
|
344
|
-
'roles',
|
|
345
|
-
'unrestricted',
|
|
346
|
-
'access_rules',
|
|
347
|
-
'expires_at',
|
|
348
|
-
)
|
|
349
|
-
return (
|
|
350
|
-
columns,
|
|
351
|
-
(
|
|
352
|
-
utils.get_dict_properties(
|
|
353
|
-
app_cred,
|
|
354
|
-
columns,
|
|
355
|
-
)
|
|
356
|
-
),
|
|
357
|
-
)
|
|
378
|
+
return _format_application_credential(application_credential)
|
|
@@ -9,24 +9,24 @@
|
|
|
9
9
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
|
-
#
|
|
13
12
|
|
|
14
13
|
"""Identity v3 Service Catalog action implementations"""
|
|
15
14
|
|
|
16
15
|
import logging
|
|
16
|
+
import typing as ty
|
|
17
17
|
|
|
18
18
|
from cliff import columns as cliff_columns
|
|
19
|
-
from osc_lib.command import command
|
|
20
19
|
from osc_lib import exceptions
|
|
21
20
|
from osc_lib import utils
|
|
22
21
|
|
|
22
|
+
from openstackclient import command
|
|
23
23
|
from openstackclient.i18n import _
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
LOG = logging.getLogger(__name__)
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
class EndpointsColumn(cliff_columns.FormattableColumn):
|
|
29
|
+
class EndpointsColumn(cliff_columns.FormattableColumn[ty.Any]):
|
|
30
30
|
def human_readable(self):
|
|
31
31
|
if not self._value:
|
|
32
32
|
return ""
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
import logging
|
|
19
19
|
|
|
20
|
-
from osc_lib.command import command
|
|
21
20
|
from osc_lib import exceptions
|
|
22
21
|
from osc_lib import utils
|
|
23
22
|
|
|
23
|
+
from openstackclient import command
|
|
24
24
|
from openstackclient.i18n import _
|
|
25
25
|
from openstackclient.identity import common
|
|
26
26
|
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
import logging
|
|
19
19
|
|
|
20
20
|
from openstack import exceptions as sdk_exceptions
|
|
21
|
-
from osc_lib.command import command
|
|
22
21
|
from osc_lib import exceptions
|
|
23
22
|
from osc_lib import utils
|
|
24
23
|
|
|
24
|
+
from openstackclient import command
|
|
25
25
|
from openstackclient.i18n import _
|
|
26
26
|
from openstackclient.identity import common
|
|
27
27
|
|
|
@@ -94,7 +94,9 @@ class CreateDomain(command.ShowOne):
|
|
|
94
94
|
def take_action(self, parsed_args):
|
|
95
95
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
96
96
|
|
|
97
|
-
options =
|
|
97
|
+
options = {}
|
|
98
|
+
if parsed_args.immutable is not None:
|
|
99
|
+
options['immutable'] = parsed_args.immutable
|
|
98
100
|
|
|
99
101
|
try:
|
|
100
102
|
domain = identity_client.create_domain(
|
|
@@ -105,7 +107,9 @@ class CreateDomain(command.ShowOne):
|
|
|
105
107
|
)
|
|
106
108
|
except sdk_exceptions.ConflictException:
|
|
107
109
|
if parsed_args.or_show:
|
|
108
|
-
domain = identity_client.find_domain(
|
|
110
|
+
domain = identity_client.find_domain(
|
|
111
|
+
parsed_args.name, ignore_missing=False
|
|
112
|
+
)
|
|
109
113
|
LOG.info(_('Returning existing domain %s'), domain.name)
|
|
110
114
|
else:
|
|
111
115
|
raise
|
|
@@ -236,19 +240,18 @@ class SetDomain(command.Command):
|
|
|
236
240
|
|
|
237
241
|
def take_action(self, parsed_args):
|
|
238
242
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
239
|
-
domain = identity_client.find_domain(
|
|
243
|
+
domain = identity_client.find_domain(
|
|
244
|
+
parsed_args.domain, ignore_missing=False
|
|
245
|
+
)
|
|
240
246
|
kwargs = {}
|
|
241
247
|
if parsed_args.name:
|
|
242
248
|
kwargs['name'] = parsed_args.name
|
|
243
249
|
if parsed_args.description:
|
|
244
250
|
kwargs['description'] = parsed_args.description
|
|
245
|
-
|
|
246
251
|
if parsed_args.is_enabled is not None:
|
|
247
252
|
kwargs['is_enabled'] = parsed_args.is_enabled
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if options:
|
|
251
|
-
kwargs['options'] = options
|
|
253
|
+
if parsed_args.immutable is not None:
|
|
254
|
+
kwargs['options'] = {'immutable': parsed_args.immutable}
|
|
252
255
|
|
|
253
256
|
identity_client.update_domain(domain.id, **kwargs)
|
|
254
257
|
|
|
@@ -267,6 +270,8 @@ class ShowDomain(command.ShowOne):
|
|
|
267
270
|
|
|
268
271
|
def take_action(self, parsed_args):
|
|
269
272
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
270
|
-
domain = identity_client.find_domain(
|
|
273
|
+
domain = identity_client.find_domain(
|
|
274
|
+
parsed_args.domain, ignore_missing=False
|
|
275
|
+
)
|
|
271
276
|
|
|
272
277
|
return _format_domain(domain)
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
import logging
|
|
16
16
|
|
|
17
|
-
from osc_lib.command import command
|
|
18
17
|
from osc_lib import exceptions
|
|
19
18
|
from osc_lib import utils
|
|
20
19
|
|
|
20
|
+
from openstackclient import command
|
|
21
21
|
from openstackclient.i18n import _
|
|
22
22
|
from openstackclient.identity import common
|
|
23
23
|
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
import logging
|
|
19
19
|
|
|
20
|
-
from osc_lib.command import command
|
|
21
20
|
from osc_lib import exceptions
|
|
22
21
|
from osc_lib import utils
|
|
23
22
|
|
|
23
|
+
from openstackclient import command
|
|
24
24
|
from openstackclient.i18n import _
|
|
25
25
|
from openstackclient.identity import common
|
|
26
26
|
|
|
@@ -169,7 +169,9 @@ class DeleteEndpoint(command.Command):
|
|
|
169
169
|
result = 0
|
|
170
170
|
for i in parsed_args.endpoint:
|
|
171
171
|
try:
|
|
172
|
-
endpoint_id = identity_client.find_endpoint(
|
|
172
|
+
endpoint_id = identity_client.find_endpoint(
|
|
173
|
+
i, ignore_missing=False
|
|
174
|
+
).id
|
|
173
175
|
identity_client.delete_endpoint(endpoint_id)
|
|
174
176
|
except Exception as e:
|
|
175
177
|
result += 1
|
|
@@ -230,12 +232,25 @@ class ListEndpoint(command.Lister):
|
|
|
230
232
|
|
|
231
233
|
endpoint = None
|
|
232
234
|
if parsed_args.endpoint:
|
|
233
|
-
endpoint = identity_client.find_endpoint(
|
|
234
|
-
|
|
235
|
+
endpoint = identity_client.find_endpoint(
|
|
236
|
+
parsed_args.endpoint, ignore_missing=False
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
project_domain_id = None
|
|
240
|
+
if parsed_args.project_domain:
|
|
241
|
+
project_domain_id = common._find_sdk_id(
|
|
242
|
+
identity_client.find_domain,
|
|
243
|
+
name_or_id=parsed_args.project_domain,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
project_id = None
|
|
235
247
|
if parsed_args.project:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
248
|
+
project_id = common._find_sdk_id(
|
|
249
|
+
identity_client.find_project,
|
|
250
|
+
name_or_id=common._get_token_resource(
|
|
251
|
+
identity_client, 'project', parsed_args.project
|
|
252
|
+
),
|
|
253
|
+
domain_id=project_domain_id,
|
|
239
254
|
)
|
|
240
255
|
|
|
241
256
|
if endpoint:
|
|
@@ -273,15 +288,17 @@ class ListEndpoint(command.Lister):
|
|
|
273
288
|
region = identity_client.get_region(parsed_args.region)
|
|
274
289
|
kwargs['region_id'] = region.id
|
|
275
290
|
|
|
276
|
-
if
|
|
291
|
+
if project_id:
|
|
277
292
|
data = list(
|
|
278
|
-
identity_client.project_endpoints(project=
|
|
293
|
+
identity_client.project_endpoints(project=project_id)
|
|
279
294
|
)
|
|
280
295
|
else:
|
|
281
296
|
data = list(identity_client.endpoints(**kwargs))
|
|
282
297
|
|
|
283
298
|
for ep in data:
|
|
284
|
-
service = identity_client.find_service(
|
|
299
|
+
service = identity_client.find_service(
|
|
300
|
+
ep.service_id, ignore_missing=False
|
|
301
|
+
)
|
|
285
302
|
ep.service_name = getattr(service, 'name', '')
|
|
286
303
|
ep.service_type = service.type
|
|
287
304
|
|
|
@@ -382,7 +399,9 @@ class SetEndpoint(command.Command):
|
|
|
382
399
|
|
|
383
400
|
def take_action(self, parsed_args):
|
|
384
401
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
385
|
-
endpoint = identity_client.find_endpoint(
|
|
402
|
+
endpoint = identity_client.find_endpoint(
|
|
403
|
+
parsed_args.endpoint, ignore_missing=False
|
|
404
|
+
)
|
|
386
405
|
|
|
387
406
|
kwargs = {}
|
|
388
407
|
|
|
@@ -429,7 +448,9 @@ class ShowEndpoint(command.ShowOne):
|
|
|
429
448
|
|
|
430
449
|
def take_action(self, parsed_args):
|
|
431
450
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
432
|
-
endpoint = identity_client.find_endpoint(
|
|
451
|
+
endpoint = identity_client.find_endpoint(
|
|
452
|
+
parsed_args.endpoint, ignore_missing=False
|
|
453
|
+
)
|
|
433
454
|
|
|
434
455
|
service = common.find_service_sdk(identity_client, endpoint.service_id)
|
|
435
456
|
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
import json
|
|
17
17
|
import logging
|
|
18
18
|
|
|
19
|
-
from osc_lib.command import command
|
|
20
19
|
from osc_lib import exceptions
|
|
21
20
|
from osc_lib import utils
|
|
22
21
|
|
|
22
|
+
from openstackclient import command
|
|
23
23
|
from openstackclient.i18n import _
|
|
24
24
|
from openstackclient.identity import common
|
|
25
25
|
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
import logging
|
|
19
19
|
|
|
20
20
|
from openstack import exceptions as sdk_exc
|
|
21
|
-
from osc_lib.command import command
|
|
22
21
|
from osc_lib import exceptions
|
|
23
22
|
from osc_lib import utils
|
|
24
23
|
|
|
24
|
+
from openstackclient import command
|
|
25
25
|
from openstackclient.i18n import _
|
|
26
26
|
from openstackclient.identity import common
|
|
27
27
|
|
|
@@ -211,10 +211,15 @@ class CreateGroup(command.ShowOne):
|
|
|
211
211
|
if parsed_args.or_show:
|
|
212
212
|
if parsed_args.domain:
|
|
213
213
|
group = identity_client.find_group(
|
|
214
|
-
parsed_args.name,
|
|
214
|
+
parsed_args.name,
|
|
215
|
+
domain_id=parsed_args.domain,
|
|
216
|
+
ignore_missing=False,
|
|
215
217
|
)
|
|
216
218
|
else:
|
|
217
|
-
group = identity_client.find_group(
|
|
219
|
+
group = identity_client.find_group(
|
|
220
|
+
parsed_args.name,
|
|
221
|
+
ignore_missing=False,
|
|
222
|
+
)
|
|
218
223
|
LOG.info(_('Returning existing group %s'), group.name)
|
|
219
224
|
else:
|
|
220
225
|
raise
|
|
@@ -310,8 +315,9 @@ class ListGroup(command.Lister):
|
|
|
310
315
|
parsed_args.user_domain,
|
|
311
316
|
)
|
|
312
317
|
if domain:
|
|
313
|
-
# NOTE(0weng): The API doesn't actually support filtering
|
|
314
|
-
# so this doesn't really do
|
|
318
|
+
# NOTE(0weng): The API doesn't actually support filtering
|
|
319
|
+
# additionally by domain_id, so this doesn't really do
|
|
320
|
+
# anything.
|
|
315
321
|
data = identity_client.user_groups(user, domain_id=domain)
|
|
316
322
|
else:
|
|
317
323
|
data = identity_client.user_groups(user)
|