summaryrefslogtreecommitdiff
path: root/openstackclient/identity
diff options
context:
space:
mode:
authorKristi Nikolla <knikolla@bu.edu>2017-06-16 15:04:40 -0400
committerKristi Nikolla <knikolla@bu.edu>2017-07-21 11:28:57 -0400
commit77ff011ced18260242224a7317aba92d53ff1455 (patch)
tree8a97b7ad00fdf2ab09623cbb342960bc6ff56561 /openstackclient/identity
parent26ec06e28140492689697948ce476c0f7e83f652 (diff)
downloadpython-openstackclient-77ff011ced18260242224a7317aba92d53ff1455.tar.gz
Add domain parameter to Identity Provider
Identity providers are now associated with domains. This change allows a user to specify a domain by ID or by name when creating an identity provider. [0] This also adds the column for Domain ID in listing. Updating a domain for an identity provider is not supported, so that isn't changed. [0]. Id18b8b2fe853b97631bc990df8188ed64a6e1275 Closes-Bug: 1698390 Change-Id: Icc408e2fe88f257d5863bd3df716a777d52befcc
Diffstat (limited to 'openstackclient/identity')
-rw-r--r--openstackclient/identity/v3/identity_provider.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/openstackclient/identity/v3/identity_provider.py b/openstackclient/identity/v3/identity_provider.py
index e8b3a2f4..d8951d31 100644
--- a/openstackclient/identity/v3/identity_provider.py
+++ b/openstackclient/identity/v3/identity_provider.py
@@ -21,6 +21,7 @@ from osc_lib import utils
import six
from openstackclient.i18n import _
+from openstackclient.identity import common
LOG = logging.getLogger(__name__)
@@ -55,6 +56,13 @@ class CreateIdentityProvider(command.ShowOne):
metavar='<description>',
help=_('New identity provider description'),
)
+ parser.add_argument(
+ '--domain',
+ metavar='<domain>',
+ help=_('Domain to associate with the identity provider. If not '
+ 'specified, a domain will be created automatically. '
+ '(Name or ID)'),
+ )
enable_identity_provider = parser.add_mutually_exclusive_group()
enable_identity_provider.add_argument(
'--enable',
@@ -81,10 +89,17 @@ class CreateIdentityProvider(command.ShowOne):
else:
remote_ids = (parsed_args.remote_id
if parsed_args.remote_id else None)
+
+ domain_id = None
+ if parsed_args.domain:
+ domain_id = common.find_domain(identity_client,
+ parsed_args.domain).id
+
idp = identity_client.federation.identity_providers.create(
id=parsed_args.identity_provider_id,
remote_ids=remote_ids,
description=parsed_args.description,
+ domain_id=domain_id,
enabled=parsed_args.enabled)
idp._info.pop('links', None)
@@ -129,7 +144,7 @@ class ListIdentityProvider(command.Lister):
_description = _("List identity providers")
def take_action(self, parsed_args):
- columns = ('ID', 'Enabled', 'Description')
+ columns = ('ID', 'Enabled', 'Domain ID', 'Description')
identity_client = self.app.client_manager.identity
data = identity_client.federation.identity_providers.list()
return (columns,