python-openstackclient 8.2.0__py3-none-any.whl → 9.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openstackclient/api/object_store_v1.py +4 -1
- 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 +5 -3
- openstackclient/common/project_cleanup.py +10 -8
- openstackclient/common/quota.py +54 -23
- 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 +1 -1
- 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 +78 -29
- 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 +33 -1
- 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 +4 -2
- 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 +30 -10
- 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 +10 -4
- 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 +40 -41
- 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 +86 -85
- openstackclient/identity/v3/mapping.py +1 -1
- openstackclient/identity/v3/policy.py +1 -1
- openstackclient/identity/v3/project.py +191 -115
- openstackclient/identity/v3/region.py +1 -1
- openstackclient/identity/v3/registered_limit.py +97 -109
- openstackclient/identity/v3/role.py +20 -39
- 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 +1 -11
- 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 +19 -16
- openstackclient/image/v2/cache.py +1 -1
- openstackclient/image/v2/image.py +16 -12
- openstackclient/image/v2/info.py +1 -1
- openstackclient/image/v2/metadef_namespaces.py +1 -1
- openstackclient/image/v2/metadef_objects.py +1 -1
- openstackclient/image/v2/metadef_properties.py +3 -2
- 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 +22 -20
- openstackclient/network/v2/router.py +19 -8
- openstackclient/network/v2/security_group.py +10 -6
- openstackclient/network/v2/security_group_rule.py +11 -5
- 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_catalog.py +42 -23
- openstackclient/tests/functional/identity/v3/test_limit.py +47 -0
- 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_metadef_objects.py +69 -0
- openstackclient/tests/functional/image/v2/test_metadef_resource_type.py +55 -0
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +46 -132
- 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 +79 -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 +1 -3
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -9
- openstackclient/tests/unit/compute/v2/test_server.py +370 -38
- 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 +3 -3
- openstackclient/tests/unit/identity/v3/test_domain.py +1 -1
- 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_limit.py +197 -145
- openstackclient/tests/unit/identity/v3/test_oauth.py +1 -1
- openstackclient/tests/unit/identity/v3/test_project.py +832 -513
- openstackclient/tests/unit/identity/v3/test_protocol.py +97 -88
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +356 -221
- openstackclient/tests/unit/identity/v3/test_role.py +1 -82
- openstackclient/tests/unit/identity/v3/test_user.py +7 -51
- openstackclient/tests/unit/image/v2/test_image.py +116 -5
- openstackclient/tests/unit/network/test_common.py +9 -13
- 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 +11 -21
- 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 +75 -86
- openstackclient/tests/unit/network/v2/test_router.py +104 -126
- openstackclient/tests/unit/network/v2/test_security_group_network.py +19 -26
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +17 -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_consistency_group.py +8 -2
- openstackclient/tests/unit/volume/v2/test_volume.py +7 -6
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +3 -1
- openstackclient/tests/unit/volume/v3/test_volume.py +38 -12
- 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 +9 -9
- openstackclient/volume/v2/consistency_group_snapshot.py +3 -3
- openstackclient/volume/v2/qos_specs.py +3 -3
- openstackclient/volume/v2/service.py +1 -1
- openstackclient/volume/v2/volume.py +14 -7
- openstackclient/volume/v2/volume_backend.py +1 -1
- openstackclient/volume/v2/volume_backup.py +7 -5
- openstackclient/volume/v2/volume_host.py +1 -2
- openstackclient/volume/v2/volume_snapshot.py +4 -4
- openstackclient/volume/v2/volume_transfer_request.py +3 -3
- openstackclient/volume/v2/volume_type.py +16 -11
- 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 +1 -1
- openstackclient/volume/v3/volume.py +16 -9
- openstackclient/volume/v3/volume_attachment.py +6 -5
- openstackclient/volume/v3/volume_backup.py +20 -5
- openstackclient/volume/v3/volume_group.py +1 -1
- 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 +4 -4
- openstackclient/volume/v3/volume_transfer_request.py +3 -3
- openstackclient/volume/v3/volume_type.py +20 -14
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/METADATA +15 -13
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/RECORD +231 -219
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/entry_points.txt +15 -0
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info/licenses}/AUTHORS +15 -0
- python_openstackclient-9.0.0.dist-info/pbr.json +1 -0
- openstackclient/tests/unit/common/test_logs.py +0 -221
- python_openstackclient-8.2.0.dist-info/pbr.json +0 -1
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info/licenses}/LICENSE +0 -0
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/top_level.txt +0 -0
|
@@ -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,24 +18,25 @@
|
|
|
18
18
|
import datetime
|
|
19
19
|
import json
|
|
20
20
|
import logging
|
|
21
|
+
import typing as ty
|
|
21
22
|
import uuid
|
|
22
23
|
|
|
23
24
|
from cliff import columns as cliff_columns
|
|
24
|
-
from osc_lib.command import command
|
|
25
25
|
from osc_lib import exceptions
|
|
26
26
|
from osc_lib import utils
|
|
27
27
|
|
|
28
|
+
from openstackclient import command
|
|
28
29
|
from openstackclient.i18n import _
|
|
29
30
|
from openstackclient.identity import common
|
|
30
31
|
|
|
31
32
|
LOG = logging.getLogger(__name__)
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
class RolesColumn(cliff_columns.FormattableColumn):
|
|
35
|
+
class RolesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
|
35
36
|
"""Generate a formatted string of role names."""
|
|
36
37
|
|
|
37
38
|
def human_readable(self):
|
|
38
|
-
return utils.format_list(r['name'] for r in self._value)
|
|
39
|
+
return utils.format_list(list(r['name'] for r in self._value))
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
def _format_application_credential(
|
|
@@ -148,6 +149,7 @@ class CreateApplicationCredential(command.ShowOne):
|
|
|
148
149
|
parser.add_argument(
|
|
149
150
|
'--role',
|
|
150
151
|
metavar='<role>',
|
|
152
|
+
dest='roles',
|
|
151
153
|
action='append',
|
|
152
154
|
default=[],
|
|
153
155
|
help=_(
|
|
@@ -204,10 +206,15 @@ class CreateApplicationCredential(command.ShowOne):
|
|
|
204
206
|
def take_action(self, parsed_args):
|
|
205
207
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
206
208
|
conn = self.app.client_manager.sdk_connection
|
|
207
|
-
|
|
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)
|
|
208
215
|
|
|
209
216
|
role_ids = []
|
|
210
|
-
for role in parsed_args.
|
|
217
|
+
for role in parsed_args.roles:
|
|
211
218
|
if is_uuid_like(role):
|
|
212
219
|
role_ids.append({'id': role})
|
|
213
220
|
else:
|
|
@@ -272,13 +279,18 @@ class DeleteApplicationCredential(command.Command):
|
|
|
272
279
|
def take_action(self, parsed_args):
|
|
273
280
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
274
281
|
conn = self.app.client_manager.sdk_connection
|
|
275
|
-
|
|
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)
|
|
276
288
|
|
|
277
289
|
errors = 0
|
|
278
290
|
for ac in parsed_args.application_credential:
|
|
279
291
|
try:
|
|
280
292
|
app_cred = identity_client.find_application_credential(
|
|
281
|
-
user_id, ac
|
|
293
|
+
user_id, ac, ignore_missing=False
|
|
282
294
|
)
|
|
283
295
|
identity_client.delete_application_credential(
|
|
284
296
|
user_id, app_cred.id
|
|
@@ -325,7 +337,11 @@ class ListApplicationCredential(command.Lister):
|
|
|
325
337
|
)
|
|
326
338
|
else:
|
|
327
339
|
conn = self.app.client_manager.sdk_connection
|
|
328
|
-
|
|
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)
|
|
329
345
|
|
|
330
346
|
application_credentials = identity_client.application_credentials(
|
|
331
347
|
user=user_id
|
|
@@ -349,10 +365,14 @@ class ShowApplicationCredential(command.ShowOne):
|
|
|
349
365
|
def take_action(self, parsed_args):
|
|
350
366
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
351
367
|
conn = self.app.client_manager.sdk_connection
|
|
352
|
-
|
|
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)
|
|
353
373
|
|
|
354
374
|
application_credential = identity_client.find_application_credential(
|
|
355
|
-
user_id, parsed_args.application_credential
|
|
375
|
+
user_id, parsed_args.application_credential, ignore_missing=False
|
|
356
376
|
)
|
|
357
377
|
|
|
358
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
|
|
|
@@ -107,7 +107,9 @@ class CreateDomain(command.ShowOne):
|
|
|
107
107
|
)
|
|
108
108
|
except sdk_exceptions.ConflictException:
|
|
109
109
|
if parsed_args.or_show:
|
|
110
|
-
domain = identity_client.find_domain(
|
|
110
|
+
domain = identity_client.find_domain(
|
|
111
|
+
parsed_args.name, ignore_missing=False
|
|
112
|
+
)
|
|
111
113
|
LOG.info(_('Returning existing domain %s'), domain.name)
|
|
112
114
|
else:
|
|
113
115
|
raise
|
|
@@ -238,7 +240,9 @@ class SetDomain(command.Command):
|
|
|
238
240
|
|
|
239
241
|
def take_action(self, parsed_args):
|
|
240
242
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
241
|
-
domain = identity_client.find_domain(
|
|
243
|
+
domain = identity_client.find_domain(
|
|
244
|
+
parsed_args.domain, ignore_missing=False
|
|
245
|
+
)
|
|
242
246
|
kwargs = {}
|
|
243
247
|
if parsed_args.name:
|
|
244
248
|
kwargs['name'] = parsed_args.name
|
|
@@ -266,6 +270,8 @@ class ShowDomain(command.ShowOne):
|
|
|
266
270
|
|
|
267
271
|
def take_action(self, parsed_args):
|
|
268
272
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
269
|
-
domain = identity_client.find_domain(
|
|
273
|
+
domain = identity_client.find_domain(
|
|
274
|
+
parsed_args.domain, ignore_missing=False
|
|
275
|
+
)
|
|
270
276
|
|
|
271
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
|
|
|
@@ -16,16 +16,25 @@
|
|
|
16
16
|
|
|
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
|
|
|
25
25
|
|
|
26
26
|
LOG = logging.getLogger(__name__)
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
def _format_protocol(protocol):
|
|
30
|
+
columns = ('name', 'idp_id', 'mapping_id')
|
|
31
|
+
column_headers = ('id', 'identity_provider', 'mapping')
|
|
32
|
+
return (
|
|
33
|
+
column_headers,
|
|
34
|
+
utils.get_item_properties(protocol, columns),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
29
38
|
class CreateProtocol(command.ShowOne):
|
|
30
39
|
_description = _("Create new federation protocol")
|
|
31
40
|
|
|
@@ -58,21 +67,15 @@ class CreateProtocol(command.ShowOne):
|
|
|
58
67
|
return parser
|
|
59
68
|
|
|
60
69
|
def take_action(self, parsed_args):
|
|
61
|
-
identity_client = self.app.client_manager.identity
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
71
|
+
|
|
72
|
+
protocol = identity_client.create_federation_protocol(
|
|
73
|
+
name=parsed_args.federation_protocol,
|
|
74
|
+
idp_id=parsed_args.identity_provider,
|
|
75
|
+
mapping_id=parsed_args.mapping,
|
|
66
76
|
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# from Keystone, however it should be listed to the user. Add it
|
|
70
|
-
# manually to the output list, simply reusing value provided by the
|
|
71
|
-
# user.
|
|
72
|
-
info['identity_provider'] = parsed_args.identity_provider
|
|
73
|
-
info['mapping'] = info.pop('mapping_id')
|
|
74
|
-
info.pop('links', None)
|
|
75
|
-
return zip(*sorted(info.items()))
|
|
77
|
+
|
|
78
|
+
return _format_protocol(protocol)
|
|
76
79
|
|
|
77
80
|
|
|
78
81
|
class DeleteProtocol(command.Command):
|
|
@@ -99,12 +102,15 @@ class DeleteProtocol(command.Command):
|
|
|
99
102
|
return parser
|
|
100
103
|
|
|
101
104
|
def take_action(self, parsed_args):
|
|
102
|
-
identity_client = self.app.client_manager.identity
|
|
105
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
106
|
+
|
|
103
107
|
result = 0
|
|
104
108
|
for i in parsed_args.federation_protocol:
|
|
105
109
|
try:
|
|
106
|
-
identity_client.
|
|
107
|
-
parsed_args.identity_provider,
|
|
110
|
+
identity_client.delete_federation_protocol(
|
|
111
|
+
idp_id=parsed_args.identity_provider,
|
|
112
|
+
protocol=i,
|
|
113
|
+
ignore_missing=False,
|
|
108
114
|
)
|
|
109
115
|
except Exception as e:
|
|
110
116
|
result += 1
|
|
@@ -140,9 +146,9 @@ class ListProtocols(command.Lister):
|
|
|
140
146
|
return parser
|
|
141
147
|
|
|
142
148
|
def take_action(self, parsed_args):
|
|
143
|
-
identity_client = self.app.client_manager.identity
|
|
149
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
144
150
|
|
|
145
|
-
protocols = identity_client.
|
|
151
|
+
protocols = identity_client.federation_protocols(
|
|
146
152
|
parsed_args.identity_provider
|
|
147
153
|
)
|
|
148
154
|
columns = ('id', 'mapping')
|
|
@@ -181,21 +187,16 @@ class SetProtocol(command.Command):
|
|
|
181
187
|
return parser
|
|
182
188
|
|
|
183
189
|
def take_action(self, parsed_args):
|
|
184
|
-
identity_client = self.app.client_manager.identity
|
|
190
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
185
191
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
parsed_args.federation_protocol
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
# manually to the output list, simply reusing value provided by the
|
|
195
|
-
# user.
|
|
196
|
-
info['identity_provider'] = parsed_args.identity_provider
|
|
197
|
-
info['mapping'] = info.pop('mapping_id')
|
|
198
|
-
return zip(*sorted(info.items()))
|
|
192
|
+
kwargs = {'idp_id': parsed_args.identity_provider}
|
|
193
|
+
if parsed_args.federation_protocol:
|
|
194
|
+
kwargs['name'] = parsed_args.federation_protocol
|
|
195
|
+
if parsed_args.mapping:
|
|
196
|
+
kwargs['mapping_id'] = parsed_args.mapping
|
|
197
|
+
|
|
198
|
+
protocol = identity_client.update_federation_protocol(**kwargs)
|
|
199
|
+
return _format_protocol(protocol)
|
|
199
200
|
|
|
200
201
|
|
|
201
202
|
class ShowProtocol(command.ShowOne):
|
|
@@ -220,12 +221,10 @@ class ShowProtocol(command.ShowOne):
|
|
|
220
221
|
return parser
|
|
221
222
|
|
|
222
223
|
def take_action(self, parsed_args):
|
|
223
|
-
identity_client = self.app.client_manager.identity
|
|
224
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
224
225
|
|
|
225
|
-
protocol = identity_client.
|
|
226
|
-
parsed_args.identity_provider,
|
|
226
|
+
protocol = identity_client.get_federation_protocol(
|
|
227
|
+
idp_id=parsed_args.identity_provider,
|
|
228
|
+
protocol=parsed_args.federation_protocol,
|
|
227
229
|
)
|
|
228
|
-
|
|
229
|
-
info['mapping'] = info.pop('mapping_id')
|
|
230
|
-
info.pop('links', None)
|
|
231
|
-
return zip(*sorted(info.items()))
|
|
230
|
+
return _format_protocol(protocol)
|
|
@@ -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)
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
import logging
|
|
17
17
|
|
|
18
18
|
from osc_lib.cli import format_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
|
from openstackclient.identity import common
|
|
25
25
|
|
|
@@ -41,6 +41,7 @@ class CreateIdentityProvider(command.ShowOne):
|
|
|
41
41
|
identity_remote_id_provider.add_argument(
|
|
42
42
|
'--remote-id',
|
|
43
43
|
metavar='<remote-id>',
|
|
44
|
+
dest='remote_ids',
|
|
44
45
|
action='append',
|
|
45
46
|
help=_(
|
|
46
47
|
'Remote IDs to associate with the Identity Provider '
|
|
@@ -99,16 +100,15 @@ class CreateIdentityProvider(command.ShowOne):
|
|
|
99
100
|
|
|
100
101
|
def take_action(self, parsed_args):
|
|
101
102
|
identity_client = self.app.client_manager.identity
|
|
103
|
+
remote_ids: list[str] | None = None
|
|
102
104
|
if parsed_args.remote_id_file:
|
|
103
105
|
file_content = utils.read_blob_file_contents(
|
|
104
106
|
parsed_args.remote_id_file
|
|
105
107
|
)
|
|
106
108
|
remote_ids = file_content.splitlines()
|
|
107
109
|
remote_ids = list(map(str.strip, remote_ids))
|
|
108
|
-
|
|
109
|
-
remote_ids =
|
|
110
|
-
parsed_args.remote_id if parsed_args.remote_id else None
|
|
111
|
-
)
|
|
110
|
+
elif parsed_args.remote_ids:
|
|
111
|
+
remote_ids = parsed_args.remote_ids
|
|
112
112
|
|
|
113
113
|
domain_id = None
|
|
114
114
|
if parsed_args.domain:
|
|
@@ -137,8 +137,9 @@ class CreateIdentityProvider(command.ShowOne):
|
|
|
137
137
|
)
|
|
138
138
|
|
|
139
139
|
idp._info.pop('links', None)
|
|
140
|
-
remote_ids = format_columns.ListColumn(
|
|
141
|
-
|
|
140
|
+
idp._info['remote_ids'] = format_columns.ListColumn(
|
|
141
|
+
idp._info.pop('remote_ids', [])
|
|
142
|
+
)
|
|
142
143
|
return zip(*sorted(idp._info.items()))
|
|
143
144
|
|
|
144
145
|
|
|
@@ -240,6 +241,7 @@ class SetIdentityProvider(command.Command):
|
|
|
240
241
|
identity_remote_id_provider.add_argument(
|
|
241
242
|
'--remote-id',
|
|
242
243
|
metavar='<remote-id>',
|
|
244
|
+
dest='remote_ids',
|
|
243
245
|
action='append',
|
|
244
246
|
help=_(
|
|
245
247
|
'Remote IDs to associate with the Identity Provider '
|
|
@@ -287,8 +289,8 @@ class SetIdentityProvider(command.Command):
|
|
|
287
289
|
)
|
|
288
290
|
remote_ids = file_content.splitlines()
|
|
289
291
|
remote_ids = list(map(str.strip, remote_ids))
|
|
290
|
-
elif parsed_args.
|
|
291
|
-
remote_ids = parsed_args.
|
|
292
|
+
elif parsed_args.remote_ids:
|
|
293
|
+
remote_ids = parsed_args.remote_ids
|
|
292
294
|
|
|
293
295
|
# Setup keyword args for the client
|
|
294
296
|
kwargs = {}
|
|
@@ -298,7 +300,7 @@ class SetIdentityProvider(command.Command):
|
|
|
298
300
|
kwargs['enabled'] = True
|
|
299
301
|
if parsed_args.disable:
|
|
300
302
|
kwargs['enabled'] = False
|
|
301
|
-
if parsed_args.remote_id_file or parsed_args.
|
|
303
|
+
if parsed_args.remote_id_file or parsed_args.remote_ids:
|
|
302
304
|
kwargs['remote_ids'] = remote_ids
|
|
303
305
|
|
|
304
306
|
# TODO(pas-ha) actually check for 3.14 microversion
|