python-openstackclient 10.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/common/availability_zone.py +1 -1
- openstackclient/common/module.py +21 -27
- openstackclient/common/pagination.py +42 -4
- openstackclient/common/project_cleanup.py +1 -2
- openstackclient/common/quota.py +9 -5
- openstackclient/compute/v2/flavor.py +3 -1
- openstackclient/compute/v2/hypervisor.py +2 -0
- openstackclient/compute/v2/keypair.py +6 -2
- openstackclient/compute/v2/server.py +21 -12
- openstackclient/compute/v2/server_event.py +8 -1
- openstackclient/compute/v2/server_group.py +2 -0
- openstackclient/compute/v2/server_migration.py +3 -0
- openstackclient/compute/v2/server_volume.py +3 -1
- openstackclient/compute/v2/service.py +3 -1
- openstackclient/compute/v2/usage.py +2 -2
- openstackclient/identity/common.py +5 -1
- openstackclient/identity/v3/access_rule.py +6 -0
- openstackclient/identity/v3/application_credential.py +10 -3
- openstackclient/identity/v3/credential.py +4 -2
- openstackclient/identity/v3/domain.py +4 -2
- openstackclient/identity/v3/endpoint.py +57 -45
- openstackclient/identity/v3/federation_protocol.py +7 -5
- openstackclient/identity/v3/group.py +11 -10
- openstackclient/identity/v3/identity_provider.py +4 -1
- openstackclient/identity/v3/limit.py +5 -2
- openstackclient/identity/v3/mapping.py +36 -19
- openstackclient/identity/v3/project.py +18 -5
- openstackclient/identity/v3/region.py +4 -2
- openstackclient/identity/v3/registered_limit.py +3 -2
- openstackclient/identity/v3/role.py +2 -1
- openstackclient/identity/v3/role_assignment.py +3 -2
- openstackclient/identity/v3/service.py +4 -2
- openstackclient/identity/v3/service_provider.py +4 -2
- openstackclient/identity/v3/trust.py +8 -5
- openstackclient/identity/v3/user.py +38 -11
- openstackclient/image/v2/cache.py +2 -2
- openstackclient/image/v2/image.py +15 -9
- openstackclient/image/v2/metadef_namespaces.py +11 -10
- openstackclient/image/v2/metadef_objects.py +5 -5
- openstackclient/image/v2/metadef_properties.py +7 -4
- openstackclient/image/v2/task.py +11 -22
- openstackclient/network/utils.py +0 -41
- openstackclient/network/v2/address_group.py +13 -1
- openstackclient/network/v2/address_scope.py +13 -8
- openstackclient/network/v2/bgpvpn/bgpvpn.py +33 -19
- openstackclient/network/v2/bgpvpn/network_association.py +25 -13
- openstackclient/network/v2/bgpvpn/port_association.py +35 -21
- openstackclient/network/v2/bgpvpn/router_association.py +27 -14
- openstackclient/network/v2/default_security_group_rule.py +14 -6
- openstackclient/network/v2/floating_ip.py +12 -4
- openstackclient/network/v2/floating_ip_port_forwarding.py +12 -2
- openstackclient/network/v2/fwaas/group.py +34 -1
- openstackclient/network/v2/fwaas/rule.py +39 -3
- openstackclient/network/v2/ip_availability.py +13 -4
- openstackclient/network/v2/l3_conntrack_helper.py +14 -1
- openstackclient/network/v2/local_ip.py +4 -1
- openstackclient/network/v2/local_ip_association.py +4 -1
- openstackclient/network/v2/ndp_proxy.py +4 -1
- openstackclient/network/v2/network.py +87 -20
- openstackclient/network/v2/network_agent.py +32 -10
- openstackclient/network/v2/network_auto_allocated_topology.py +6 -5
- openstackclient/network/v2/network_flavor.py +19 -6
- openstackclient/network/v2/network_flavor_profile.py +20 -6
- openstackclient/network/v2/network_meter.py +19 -6
- openstackclient/network/v2/network_meter_rule.py +20 -2
- openstackclient/network/v2/network_qos_policy.py +15 -7
- openstackclient/network/v2/network_qos_rule.py +16 -1
- openstackclient/network/v2/network_qos_rule_type.py +16 -5
- openstackclient/network/v2/network_rbac.py +12 -5
- openstackclient/network/v2/network_segment.py +13 -1
- openstackclient/network/v2/network_segment_range.py +15 -3
- openstackclient/network/v2/network_trunk.py +4 -1
- openstackclient/network/v2/port.py +88 -12
- openstackclient/network/v2/router.py +27 -16
- openstackclient/network/v2/security_group.py +18 -49
- openstackclient/network/v2/security_group_rule.py +18 -5
- openstackclient/network/v2/subnet.py +15 -7
- openstackclient/network/v2/subnet_pool.py +13 -8
- openstackclient/network/v2/taas/tap_flow.py +13 -3
- openstackclient/network/v2/taas/tap_mirror.py +7 -4
- openstackclient/network/v2/taas/tap_service.py +4 -1
- openstackclient/object/v1/container.py +3 -1
- openstackclient/object/v1/object.py +3 -1
- openstackclient/tests/functional/identity/v3/common.py +34 -0
- openstackclient/tests/functional/identity/v3/test_application_credential.py +1 -1
- openstackclient/tests/functional/identity/v3/test_mapping.py +81 -0
- openstackclient/tests/functional/volume/v3/test_volume_group.py +163 -0
- openstackclient/tests/unit/common/test_limits.py +1 -1
- openstackclient/tests/unit/common/test_module.py +77 -44
- openstackclient/tests/unit/common/test_quota.py +9 -0
- openstackclient/tests/unit/compute/v2/fakes.py +1 -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 +1 -1
- 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 +1 -1
- openstackclient/tests/unit/compute/v2/test_server.py +15 -15
- 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 +4 -4
- 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 +5 -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 +8 -8
- 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 +73 -6
- openstackclient/tests/unit/network/v2/fakes.py +5 -77
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +28 -2
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +28 -3
- openstackclient/tests/unit/network/v2/test_address_group.py +24 -0
- openstackclient/tests/unit/network/v2/test_address_scope.py +24 -0
- openstackclient/tests/unit/network/v2/test_floating_ip.py +24 -0
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +24 -0
- 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 +50 -1
- openstackclient/tests/unit/network/v2/test_network_flavor.py +24 -0
- 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 +24 -0
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_rbac.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_segment.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +24 -0
- openstackclient/tests/unit/network/v2/test_port.py +166 -0
- openstackclient/tests/unit/network/v2/test_router.py +28 -7
- openstackclient/tests/unit/network/v2/test_security_group.py +22 -0
- openstackclient/tests/unit/network/v2/test_security_group_rule.py +25 -0
- openstackclient/tests/unit/network/v2/test_subnet.py +28 -4
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +24 -0
- openstackclient/tests/unit/volume/v2/fakes.py +20 -140
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +5 -9
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +6 -0
- openstackclient/tests/unit/volume/v3/fakes.py +204 -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_attachment.py +2 -0
- openstackclient/tests/unit/volume/v3/test_volume_backend.py +158 -0
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +5 -9
- 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 +6 -0
- openstackclient/volume/v2/volume.py +4 -2
- openstackclient/volume/v2/volume_backup.py +2 -3
- openstackclient/volume/v2/volume_snapshot.py +3 -4
- openstackclient/volume/v3/backup_record.py +94 -0
- 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/volume.py +4 -2
- openstackclient/volume/v3/volume_attachment.py +5 -1
- openstackclient/volume/v3/volume_backend.py +130 -0
- openstackclient/volume/v3/volume_backup.py +2 -3
- openstackclient/volume/v3/volume_group_snapshot.py +4 -6
- openstackclient/volume/v3/volume_group_type.py +1 -1
- openstackclient/volume/v3/volume_host.py +74 -0
- openstackclient/volume/v3/volume_message.py +3 -1
- openstackclient/volume/v3/volume_snapshot.py +2 -1
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/METADATA +3 -4
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/RECORD +202 -188
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/entry_points.txt +24 -24
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/AUTHORS +5 -0
- python_openstackclient-10.1.0.dist-info/pbr.json +1 -0
- python_openstackclient-10.0.0.dist-info/pbr.json +0 -1
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/top_level.txt +0 -0
|
@@ -20,6 +20,8 @@ from collections.abc import Iterable, Sequence
|
|
|
20
20
|
import logging
|
|
21
21
|
from typing import Any
|
|
22
22
|
|
|
23
|
+
from openstack.identity.v3 import endpoint as _endpoint
|
|
24
|
+
from openstack.identity.v3 import service as _service
|
|
23
25
|
from openstack import utils as sdk_utils
|
|
24
26
|
from osc_lib import exceptions
|
|
25
27
|
from osc_lib import utils
|
|
@@ -28,12 +30,11 @@ from openstackclient import command
|
|
|
28
30
|
from openstackclient.i18n import _
|
|
29
31
|
from openstackclient.identity import common
|
|
30
32
|
|
|
31
|
-
|
|
32
33
|
LOG = logging.getLogger(__name__)
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
def _format_endpoint(
|
|
36
|
-
endpoint:
|
|
37
|
+
endpoint: _endpoint.Endpoint, service: _service.Service
|
|
37
38
|
) -> tuple[tuple[str, ...], Any]:
|
|
38
39
|
columns = (
|
|
39
40
|
'is_enabled',
|
|
@@ -269,54 +270,65 @@ class ListEndpoint(command.Lister):
|
|
|
269
270
|
domain_id=project_domain_id,
|
|
270
271
|
)
|
|
271
272
|
|
|
273
|
+
# FIXME(stephenfin): This belongs under the project list command
|
|
272
274
|
if endpoint:
|
|
273
275
|
column_headers: tuple[str, ...] = ('ID', 'Name')
|
|
274
276
|
columns: tuple[str, ...] = ('id', 'name')
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
277
|
+
projects = identity_client.endpoint_projects(endpoint=endpoint.id)
|
|
278
|
+
return (
|
|
279
|
+
column_headers,
|
|
280
|
+
(
|
|
281
|
+
utils.get_item_properties(
|
|
282
|
+
s,
|
|
283
|
+
columns,
|
|
284
|
+
formatters={},
|
|
285
|
+
)
|
|
286
|
+
for s in projects
|
|
287
|
+
),
|
|
285
288
|
)
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
289
|
+
|
|
290
|
+
column_headers = (
|
|
291
|
+
'ID',
|
|
292
|
+
'Region',
|
|
293
|
+
'Service Name',
|
|
294
|
+
'Service Type',
|
|
295
|
+
'Enabled',
|
|
296
|
+
'Interface',
|
|
297
|
+
'URL',
|
|
298
|
+
)
|
|
299
|
+
columns = (
|
|
300
|
+
'id',
|
|
301
|
+
'region_id',
|
|
302
|
+
'service_name',
|
|
303
|
+
'service_type',
|
|
304
|
+
'is_enabled',
|
|
305
|
+
'interface',
|
|
306
|
+
'url',
|
|
307
|
+
)
|
|
308
|
+
kwargs = {}
|
|
309
|
+
if parsed_args.service:
|
|
310
|
+
service = common.find_service_sdk(
|
|
311
|
+
identity_client, parsed_args.service
|
|
294
312
|
)
|
|
295
|
-
kwargs =
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if parsed_args.interface:
|
|
302
|
-
kwargs['interface'] = parsed_args.interface
|
|
303
|
-
if parsed_args.region:
|
|
304
|
-
region = identity_client.get_region(parsed_args.region)
|
|
305
|
-
kwargs['region_id'] = region.id
|
|
306
|
-
|
|
307
|
-
if project_id:
|
|
308
|
-
data = list(
|
|
309
|
-
identity_client.project_endpoints(project=project_id)
|
|
310
|
-
)
|
|
311
|
-
else:
|
|
312
|
-
data = list(identity_client.endpoints(**kwargs))
|
|
313
|
+
kwargs['service_id'] = service.id
|
|
314
|
+
if parsed_args.interface:
|
|
315
|
+
kwargs['interface'] = parsed_args.interface
|
|
316
|
+
if parsed_args.region:
|
|
317
|
+
region = identity_client.get_region(parsed_args.region)
|
|
318
|
+
kwargs['region_id'] = region.id
|
|
313
319
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
data: list[_endpoint.Endpoint]
|
|
321
|
+
if project_id:
|
|
322
|
+
data = list(identity_client.project_endpoints(project=project_id))
|
|
323
|
+
else:
|
|
324
|
+
data = list(identity_client.endpoints(**kwargs))
|
|
325
|
+
|
|
326
|
+
for ep in data:
|
|
327
|
+
service = identity_client.find_service(
|
|
328
|
+
ep.service_id, ignore_missing=False
|
|
329
|
+
)
|
|
330
|
+
setattr(ep, 'service_name', getattr(service, 'name', ''))
|
|
331
|
+
setattr(ep, 'service_type', service.type)
|
|
320
332
|
|
|
321
333
|
return (
|
|
322
334
|
column_headers,
|
|
@@ -421,7 +433,7 @@ class SetEndpoint(command.Command):
|
|
|
421
433
|
parsed_args.endpoint, ignore_missing=False
|
|
422
434
|
)
|
|
423
435
|
|
|
424
|
-
kwargs = {}
|
|
436
|
+
kwargs: dict[str, object] = {}
|
|
425
437
|
|
|
426
438
|
if parsed_args.service:
|
|
427
439
|
service = common.find_service_sdk(
|
|
@@ -19,6 +19,7 @@ from collections.abc import Iterable, Sequence
|
|
|
19
19
|
import logging
|
|
20
20
|
from typing import Any
|
|
21
21
|
|
|
22
|
+
from openstack.identity.v3 import federation_protocol as _federation_protocol
|
|
22
23
|
from openstack import utils as sdk_utils
|
|
23
24
|
from osc_lib import exceptions
|
|
24
25
|
from osc_lib import utils
|
|
@@ -26,11 +27,12 @@ from osc_lib import utils
|
|
|
26
27
|
from openstackclient import command
|
|
27
28
|
from openstackclient.i18n import _
|
|
28
29
|
|
|
29
|
-
|
|
30
30
|
LOG = logging.getLogger(__name__)
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
def _format_protocol(
|
|
33
|
+
def _format_protocol(
|
|
34
|
+
protocol: _federation_protocol.FederationProtocol,
|
|
35
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
34
36
|
columns = ('name', 'idp_id', 'mapping_id')
|
|
35
37
|
column_headers = ('id', 'identity_provider', 'mapping')
|
|
36
38
|
return (
|
|
@@ -79,7 +81,7 @@ class CreateProtocol(command.ShowOne):
|
|
|
79
81
|
|
|
80
82
|
protocol = identity_client.create_federation_protocol(
|
|
81
83
|
name=parsed_args.federation_protocol,
|
|
82
|
-
|
|
84
|
+
idp=parsed_args.identity_provider,
|
|
83
85
|
mapping_id=parsed_args.mapping,
|
|
84
86
|
)
|
|
85
87
|
|
|
@@ -118,7 +120,7 @@ class DeleteProtocol(command.Command):
|
|
|
118
120
|
for i in parsed_args.federation_protocol:
|
|
119
121
|
try:
|
|
120
122
|
identity_client.delete_federation_protocol(
|
|
121
|
-
|
|
123
|
+
idp=parsed_args.identity_provider,
|
|
122
124
|
protocol=i,
|
|
123
125
|
ignore_missing=False,
|
|
124
126
|
)
|
|
@@ -246,7 +248,7 @@ class ShowProtocol(command.ShowOne):
|
|
|
246
248
|
)
|
|
247
249
|
|
|
248
250
|
protocol = identity_client.get_federation_protocol(
|
|
249
|
-
|
|
251
|
+
idp=parsed_args.identity_provider,
|
|
250
252
|
protocol=parsed_args.federation_protocol,
|
|
251
253
|
)
|
|
252
254
|
return _format_protocol(protocol)
|
|
@@ -21,6 +21,7 @@ import logging
|
|
|
21
21
|
from typing import Any
|
|
22
22
|
|
|
23
23
|
from openstack import exceptions as sdk_exc
|
|
24
|
+
from openstack.identity.v3 import group as _group
|
|
24
25
|
from openstack import utils as sdk_utils
|
|
25
26
|
from osc_lib import exceptions
|
|
26
27
|
from osc_lib import utils
|
|
@@ -29,11 +30,12 @@ from openstackclient import command
|
|
|
29
30
|
from openstackclient.i18n import _
|
|
30
31
|
from openstackclient.identity import common
|
|
31
32
|
|
|
32
|
-
|
|
33
33
|
LOG = logging.getLogger(__name__)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def _format_group(
|
|
36
|
+
def _format_group(
|
|
37
|
+
group: _group.Group,
|
|
38
|
+
) -> tuple[tuple[str, ...], Iterable[Any]]:
|
|
37
39
|
columns = (
|
|
38
40
|
'description',
|
|
39
41
|
'domain_id',
|
|
@@ -325,8 +327,12 @@ class ListGroup(command.Lister):
|
|
|
325
327
|
identity_client, parsed_args.domain
|
|
326
328
|
)
|
|
327
329
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
+
if not parsed_args.user:
|
|
331
|
+
if domain:
|
|
332
|
+
data = list(identity_client.groups(domain_id=domain))
|
|
333
|
+
else:
|
|
334
|
+
data = list(identity_client.groups())
|
|
335
|
+
else:
|
|
330
336
|
user = common.find_user_id_sdk(
|
|
331
337
|
identity_client,
|
|
332
338
|
parsed_args.user,
|
|
@@ -335,12 +341,7 @@ class ListGroup(command.Lister):
|
|
|
335
341
|
# NOTE(0weng): The API doesn't actually support filtering
|
|
336
342
|
# additionally by domain_id, so this doesn't really do
|
|
337
343
|
# anything.
|
|
338
|
-
data = identity_client.user_groups(user)
|
|
339
|
-
else:
|
|
340
|
-
if domain:
|
|
341
|
-
data = identity_client.groups(domain_id=domain)
|
|
342
|
-
else:
|
|
343
|
-
data = identity_client.groups()
|
|
344
|
+
data = list(identity_client.user_groups(user))
|
|
344
345
|
|
|
345
346
|
# List groups
|
|
346
347
|
columns: tuple[str, ...] = ('ID', 'Name')
|
|
@@ -18,6 +18,7 @@ from collections.abc import Iterable, Sequence
|
|
|
18
18
|
import logging
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
+
from openstack.identity.v3 import identity_provider as _identity_provider
|
|
21
22
|
from openstack import utils as sdk_utils
|
|
22
23
|
from osc_lib.cli import format_columns
|
|
23
24
|
from osc_lib import exceptions
|
|
@@ -31,7 +32,9 @@ from openstackclient.identity import common
|
|
|
31
32
|
LOG = logging.getLogger(__name__)
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
def _format_identity_provider(
|
|
35
|
+
def _format_identity_provider(
|
|
36
|
+
idp: _identity_provider.IdentityProvider,
|
|
37
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
35
38
|
columns = (
|
|
36
39
|
'authorization_ttl',
|
|
37
40
|
'description',
|
|
@@ -18,6 +18,7 @@ from collections.abc import Iterable, Sequence
|
|
|
18
18
|
import logging
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
+
from openstack.identity.v3 import limit as _limit
|
|
21
22
|
from openstack import utils as sdk_utils
|
|
22
23
|
from osc_lib import exceptions
|
|
23
24
|
from osc_lib import utils
|
|
@@ -29,7 +30,9 @@ from openstackclient.identity import common as common_utils
|
|
|
29
30
|
LOG = logging.getLogger(__name__)
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
def _format_limit(
|
|
33
|
+
def _format_limit(
|
|
34
|
+
limit: _limit.Limit,
|
|
35
|
+
) -> tuple[tuple[str, ...], Iterable[Any]]:
|
|
33
36
|
columns = (
|
|
34
37
|
"description",
|
|
35
38
|
"id",
|
|
@@ -164,7 +167,7 @@ class ListLimit(command.Lister):
|
|
|
164
167
|
self.app.client_manager.sdk_connection.identity, '3'
|
|
165
168
|
)
|
|
166
169
|
|
|
167
|
-
kwargs = {}
|
|
170
|
+
kwargs: dict[str, object] = {}
|
|
168
171
|
if parsed_args.service:
|
|
169
172
|
kwargs["service_id"] = common_utils.find_service_sdk(
|
|
170
173
|
identity_client, parsed_args.service
|
|
@@ -21,6 +21,8 @@ import json
|
|
|
21
21
|
import logging
|
|
22
22
|
from typing import Any
|
|
23
23
|
|
|
24
|
+
from openstack.identity.v3 import mapping as _mapping
|
|
25
|
+
from openstack import utils as sdk_utils
|
|
24
26
|
from osc_lib import exceptions
|
|
25
27
|
from osc_lib import utils
|
|
26
28
|
|
|
@@ -31,6 +33,17 @@ from openstackclient.i18n import _
|
|
|
31
33
|
LOG = logging.getLogger(__name__)
|
|
32
34
|
|
|
33
35
|
|
|
36
|
+
def _format_mapping(
|
|
37
|
+
mapping: _mapping.Mapping,
|
|
38
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
39
|
+
columns = ('id', 'rules', 'schema_version')
|
|
40
|
+
column_headers = ('id', 'rules', 'schema_version')
|
|
41
|
+
return (
|
|
42
|
+
column_headers,
|
|
43
|
+
utils.get_item_properties(mapping, columns),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
34
47
|
class _RulesReader:
|
|
35
48
|
_description = _("Helper class capable of reading rules from files")
|
|
36
49
|
|
|
@@ -124,18 +137,18 @@ class CreateMapping(command.ShowOne, _RulesReader):
|
|
|
124
137
|
def take_action(
|
|
125
138
|
self, parsed_args: argparse.Namespace
|
|
126
139
|
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
127
|
-
identity_client =
|
|
140
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
141
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
142
|
+
)
|
|
128
143
|
|
|
129
144
|
rules = self._read_rules(parsed_args.rules)
|
|
130
|
-
mapping = identity_client.
|
|
131
|
-
|
|
145
|
+
mapping = identity_client.create_mapping(
|
|
146
|
+
id=parsed_args.mapping,
|
|
132
147
|
rules=rules,
|
|
133
148
|
schema_version=parsed_args.schema_version,
|
|
134
149
|
)
|
|
135
150
|
|
|
136
|
-
mapping
|
|
137
|
-
col_headers, col_data = zip(*sorted(mapping._info.items()))
|
|
138
|
-
return col_headers, col_data
|
|
151
|
+
return _format_mapping(mapping)
|
|
139
152
|
|
|
140
153
|
|
|
141
154
|
class DeleteMapping(command.Command):
|
|
@@ -152,11 +165,13 @@ class DeleteMapping(command.Command):
|
|
|
152
165
|
return parser
|
|
153
166
|
|
|
154
167
|
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
155
|
-
identity_client =
|
|
168
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
169
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
170
|
+
)
|
|
156
171
|
result = 0
|
|
157
172
|
for i in parsed_args.mapping:
|
|
158
173
|
try:
|
|
159
|
-
identity_client.
|
|
174
|
+
identity_client.delete_mapping(i, ignore_missing=False)
|
|
160
175
|
except Exception as e:
|
|
161
176
|
result += 1
|
|
162
177
|
LOG.error(
|
|
@@ -185,8 +200,10 @@ class ListMapping(command.Lister):
|
|
|
185
200
|
# NOTE(marek-denis): Since rules can be long and tedious I have decided
|
|
186
201
|
# to only list ids of the mappings. If somebody wants to check the
|
|
187
202
|
# rules, (s)he should show specific ones.
|
|
188
|
-
identity_client =
|
|
189
|
-
|
|
203
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
204
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
205
|
+
)
|
|
206
|
+
data = identity_client.mappings()
|
|
190
207
|
columns = ('ID', 'schema_version')
|
|
191
208
|
items = [utils.get_item_properties(s, columns) for s in data]
|
|
192
209
|
return (columns, items)
|
|
@@ -212,18 +229,18 @@ class SetMapping(command.Command, _RulesReader):
|
|
|
212
229
|
return parser
|
|
213
230
|
|
|
214
231
|
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
215
|
-
identity_client =
|
|
232
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
233
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
234
|
+
)
|
|
216
235
|
|
|
217
236
|
rules = self._read_rules(parsed_args.rules)
|
|
218
237
|
|
|
219
|
-
|
|
238
|
+
identity_client.update_mapping(
|
|
220
239
|
mapping=parsed_args.mapping,
|
|
221
240
|
rules=rules,
|
|
222
241
|
schema_version=parsed_args.schema_version,
|
|
223
242
|
)
|
|
224
243
|
|
|
225
|
-
mapping._info.pop('links', None)
|
|
226
|
-
|
|
227
244
|
|
|
228
245
|
class ShowMapping(command.ShowOne):
|
|
229
246
|
_description = _("Display mapping details")
|
|
@@ -240,10 +257,10 @@ class ShowMapping(command.ShowOne):
|
|
|
240
257
|
def take_action(
|
|
241
258
|
self, parsed_args: argparse.Namespace
|
|
242
259
|
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
243
|
-
identity_client =
|
|
260
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
261
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
262
|
+
)
|
|
244
263
|
|
|
245
|
-
mapping = identity_client.
|
|
264
|
+
mapping = identity_client.get_mapping(parsed_args.mapping)
|
|
246
265
|
|
|
247
|
-
mapping
|
|
248
|
-
col_headers, col_data = zip(*sorted(mapping._info.items()))
|
|
249
|
-
return col_headers, col_data
|
|
266
|
+
return _format_mapping(mapping)
|
|
@@ -21,12 +21,14 @@ import logging
|
|
|
21
21
|
from typing import Any
|
|
22
22
|
|
|
23
23
|
from openstack import exceptions as sdk_exc
|
|
24
|
+
from openstack.identity.v3 import project as _project
|
|
24
25
|
from openstack import utils as sdk_utils
|
|
25
26
|
from osc_lib.cli import parseractions
|
|
26
27
|
from osc_lib import exceptions
|
|
27
28
|
from osc_lib import utils
|
|
28
29
|
|
|
29
30
|
from openstackclient import command
|
|
31
|
+
from openstackclient.common import pagination
|
|
30
32
|
from openstackclient.i18n import _
|
|
31
33
|
from openstackclient.identity import common
|
|
32
34
|
from openstackclient.identity.v3 import tag
|
|
@@ -34,10 +36,12 @@ from openstackclient.identity.v3 import tag
|
|
|
34
36
|
LOG = logging.getLogger(__name__)
|
|
35
37
|
|
|
36
38
|
|
|
37
|
-
def _format_project(
|
|
39
|
+
def _format_project(
|
|
40
|
+
project: _project.Project,
|
|
41
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
38
42
|
# NOTE(0weng): Projects allow unknown attributes in the body, so extract
|
|
39
43
|
# the column names separately.
|
|
40
|
-
|
|
44
|
+
column_headers, columns = utils.get_osc_show_columns_for_sdk_resource(
|
|
41
45
|
project,
|
|
42
46
|
{'is_enabled': 'enabled'},
|
|
43
47
|
['links', 'location', 'parents_as_ids', 'subtree_as_ids'],
|
|
@@ -297,6 +301,7 @@ class ListProject(command.Lister):
|
|
|
297
301
|
help=_('List only disabled projects'),
|
|
298
302
|
)
|
|
299
303
|
tag.add_tag_filtering_option_to_parser(parser, _('projects'))
|
|
304
|
+
pagination.add_marker_pagination_option_to_parser(parser)
|
|
300
305
|
return parser
|
|
301
306
|
|
|
302
307
|
def take_action(
|
|
@@ -348,6 +353,13 @@ class ListProject(command.Lister):
|
|
|
348
353
|
if parsed_args.is_enabled is not None:
|
|
349
354
|
kwargs['is_enabled'] = parsed_args.is_enabled
|
|
350
355
|
|
|
356
|
+
if parsed_args.limit is not None:
|
|
357
|
+
kwargs['limit'] = parsed_args.limit
|
|
358
|
+
if parsed_args.max_items is not None:
|
|
359
|
+
kwargs['max_items'] = parsed_args.max_items
|
|
360
|
+
if parsed_args.marker is not None:
|
|
361
|
+
kwargs['marker'] = parsed_args.marker
|
|
362
|
+
|
|
351
363
|
tag.get_tag_filtering_args(parsed_args, kwargs)
|
|
352
364
|
|
|
353
365
|
if parsed_args.my_projects:
|
|
@@ -355,9 +367,7 @@ class ListProject(command.Lister):
|
|
|
355
367
|
kwargs = {}
|
|
356
368
|
user = self.app.client_manager.auth_ref.user_id
|
|
357
369
|
|
|
358
|
-
if user:
|
|
359
|
-
data = list(identity_client.user_projects(user, **kwargs))
|
|
360
|
-
else:
|
|
370
|
+
if not user:
|
|
361
371
|
try:
|
|
362
372
|
data = list(identity_client.projects(**kwargs))
|
|
363
373
|
except sdk_exc.ForbiddenException:
|
|
@@ -365,9 +375,12 @@ class ListProject(command.Lister):
|
|
|
365
375
|
# wanting their own project list.
|
|
366
376
|
if not kwargs:
|
|
367
377
|
user = self.app.client_manager.auth_ref.user_id
|
|
378
|
+
assert user is not None, 'this should not happen'
|
|
368
379
|
data = list(identity_client.user_projects(user))
|
|
369
380
|
else:
|
|
370
381
|
raise
|
|
382
|
+
else:
|
|
383
|
+
data = list(identity_client.user_projects(user, **kwargs))
|
|
371
384
|
|
|
372
385
|
if parsed_args.sort:
|
|
373
386
|
data = list(utils.sort_items(data, parsed_args.sort))
|
|
@@ -18,6 +18,7 @@ from collections.abc import Iterable, Sequence
|
|
|
18
18
|
import logging
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
+
from openstack.identity.v3 import region as _region
|
|
21
22
|
from openstack import utils as sdk_utils
|
|
22
23
|
from osc_lib import exceptions
|
|
23
24
|
from osc_lib import utils
|
|
@@ -25,11 +26,12 @@ from osc_lib import utils
|
|
|
25
26
|
from openstackclient import command
|
|
26
27
|
from openstackclient.i18n import _
|
|
27
28
|
|
|
28
|
-
|
|
29
29
|
LOG = logging.getLogger(__name__)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def _format_region(
|
|
32
|
+
def _format_region(
|
|
33
|
+
region: _region.Region,
|
|
34
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
33
35
|
columns = ('id', 'description', 'parent_region_id')
|
|
34
36
|
column_headers = ('region', 'description', 'parent_region')
|
|
35
37
|
return (
|
|
@@ -18,6 +18,7 @@ from collections.abc import Iterable, Sequence
|
|
|
18
18
|
import logging
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
+
from openstack.identity.v3 import registered_limit as _registered_limit
|
|
21
22
|
from openstack import utils as sdk_utils
|
|
22
23
|
from osc_lib import exceptions
|
|
23
24
|
from osc_lib import utils
|
|
@@ -30,8 +31,8 @@ LOG = logging.getLogger(__name__)
|
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
def _format_registered_limit(
|
|
33
|
-
registered_limit:
|
|
34
|
-
) -> tuple[tuple[str, ...], Any]:
|
|
34
|
+
registered_limit: _registered_limit.RegisteredLimit,
|
|
35
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
35
36
|
columns = (
|
|
36
37
|
'default_limit',
|
|
37
38
|
'description',
|
|
@@ -21,6 +21,7 @@ import logging
|
|
|
21
21
|
from typing import Any
|
|
22
22
|
|
|
23
23
|
from openstack import exceptions as sdk_exc
|
|
24
|
+
from openstack.identity.v3 import role as _role
|
|
24
25
|
from openstack import utils as sdk_utils
|
|
25
26
|
from osc_lib import exceptions
|
|
26
27
|
from osc_lib import utils
|
|
@@ -33,7 +34,7 @@ from openstackclient.identity import common
|
|
|
33
34
|
LOG = logging.getLogger(__name__)
|
|
34
35
|
|
|
35
36
|
|
|
36
|
-
def _format_role(role:
|
|
37
|
+
def _format_role(role: _role.Role) -> tuple[tuple[str, ...], Iterable[Any]]:
|
|
37
38
|
columns = (
|
|
38
39
|
"id",
|
|
39
40
|
"name",
|
|
@@ -17,6 +17,7 @@ import argparse
|
|
|
17
17
|
from collections.abc import Iterable
|
|
18
18
|
from typing import Any
|
|
19
19
|
|
|
20
|
+
from openstack.identity.v3 import role_assignment as _role_assignment
|
|
20
21
|
from openstack import utils as sdk_utils
|
|
21
22
|
from osc_lib import exceptions
|
|
22
23
|
|
|
@@ -26,7 +27,7 @@ from openstackclient.identity import common
|
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
def _format_role_assignment_(
|
|
29
|
-
assignment:
|
|
30
|
+
assignment: _role_assignment.RoleAssignment, include_names: bool
|
|
30
31
|
) -> tuple[Any, ...]:
|
|
31
32
|
def _get_names(attr: Any) -> str:
|
|
32
33
|
return (
|
|
@@ -250,7 +251,7 @@ class ListRoleAssignment(command.Lister):
|
|
|
250
251
|
data_parsed = []
|
|
251
252
|
for assignment in data:
|
|
252
253
|
data_parsed.append(
|
|
253
|
-
_format_role_assignment_(assignment, include_names)
|
|
254
|
+
_format_role_assignment_(assignment, bool(include_names))
|
|
254
255
|
)
|
|
255
256
|
|
|
256
257
|
return columns, tuple(data_parsed)
|
|
@@ -20,6 +20,7 @@ from collections.abc import Iterable, Sequence
|
|
|
20
20
|
import logging
|
|
21
21
|
from typing import Any
|
|
22
22
|
|
|
23
|
+
from openstack.identity.v3 import service as _service
|
|
23
24
|
from openstack import utils as sdk_utils
|
|
24
25
|
from osc_lib import exceptions
|
|
25
26
|
from osc_lib import utils
|
|
@@ -28,11 +29,12 @@ from openstackclient import command
|
|
|
28
29
|
from openstackclient.i18n import _
|
|
29
30
|
from openstackclient.identity import common
|
|
30
31
|
|
|
31
|
-
|
|
32
32
|
LOG = logging.getLogger(__name__)
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def _format_service(
|
|
35
|
+
def _format_service(
|
|
36
|
+
service: _service.Service,
|
|
37
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
36
38
|
columns = (
|
|
37
39
|
'id',
|
|
38
40
|
'name',
|
|
@@ -18,6 +18,7 @@ from collections.abc import Iterable, Sequence
|
|
|
18
18
|
import logging
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
+
from openstack.identity.v3 import service_provider as _service_provider
|
|
21
22
|
from openstack import utils as sdk_utils
|
|
22
23
|
from osc_lib import exceptions
|
|
23
24
|
from osc_lib import utils
|
|
@@ -25,11 +26,12 @@ from osc_lib import utils
|
|
|
25
26
|
from openstackclient import command
|
|
26
27
|
from openstackclient.i18n import _
|
|
27
28
|
|
|
28
|
-
|
|
29
29
|
LOG = logging.getLogger(__name__)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def _format_service_provider(
|
|
32
|
+
def _format_service_provider(
|
|
33
|
+
sp: _service_provider.ServiceProvider,
|
|
34
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
33
35
|
column_headers = (
|
|
34
36
|
'id',
|
|
35
37
|
'enabled',
|
|
@@ -21,6 +21,7 @@ import logging
|
|
|
21
21
|
from typing import Any
|
|
22
22
|
|
|
23
23
|
from openstack import exceptions as sdk_exceptions
|
|
24
|
+
from openstack.identity.v3 import trust as _trust
|
|
24
25
|
from openstack import utils as sdk_utils
|
|
25
26
|
from osc_lib import exceptions
|
|
26
27
|
from osc_lib import utils
|
|
@@ -29,11 +30,12 @@ from openstackclient import command
|
|
|
29
30
|
from openstackclient.i18n import _
|
|
30
31
|
from openstackclient.identity import common
|
|
31
32
|
|
|
32
|
-
|
|
33
33
|
LOG = logging.getLogger(__name__)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def _format_trust(
|
|
36
|
+
def _format_trust(
|
|
37
|
+
trust: _trust.Trust,
|
|
38
|
+
) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
37
39
|
columns = (
|
|
38
40
|
'expires_at',
|
|
39
41
|
'id',
|
|
@@ -371,9 +373,10 @@ class ListTrust(command.Lister):
|
|
|
371
373
|
except sdk_exceptions.ForbiddenException:
|
|
372
374
|
trustee = parsed_args.trustee
|
|
373
375
|
|
|
374
|
-
data =
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
data = list(
|
|
377
|
+
identity_client.trusts(
|
|
378
|
+
trustor_user_id=trustor, trustee_user_id=trustee
|
|
379
|
+
)
|
|
377
380
|
)
|
|
378
381
|
|
|
379
382
|
column_headers = (
|