2015-08-03 09:32:56 +10:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
|
|
|
from keystoneauth1 import identity
|
2015-08-05 13:42:12 +10:00
|
|
|
from keystoneauth1 import loading
|
2015-08-03 09:32:56 +10:00
|
|
|
|
|
|
|
|
2015-10-19 12:32:44 +11:00
|
|
|
class Token(loading.BaseV2Loader):
|
2015-08-03 09:32:56 +10:00
|
|
|
|
|
|
|
@property
|
|
|
|
def plugin_class(self):
|
|
|
|
return identity.V2Token
|
|
|
|
|
|
|
|
def get_options(self):
|
2015-08-25 10:07:59 +10:00
|
|
|
options = super(Token, self).get_options()
|
2015-08-03 09:32:56 +10:00
|
|
|
|
|
|
|
options.extend([
|
2015-08-05 13:42:12 +10:00
|
|
|
loading.Opt('token', secret=True, help='Token'),
|
2015-08-03 09:32:56 +10:00
|
|
|
])
|
|
|
|
|
|
|
|
return options
|
|
|
|
|
|
|
|
|
2015-10-19 12:32:44 +11:00
|
|
|
class Password(loading.BaseV2Loader):
|
2015-08-03 09:32:56 +10:00
|
|
|
|
|
|
|
@property
|
|
|
|
def plugin_class(self):
|
|
|
|
return identity.V2Password
|
|
|
|
|
|
|
|
def get_options(self):
|
2015-08-25 10:07:59 +10:00
|
|
|
options = super(Password, self).get_options()
|
2015-08-03 09:32:56 +10:00
|
|
|
|
|
|
|
options.extend([
|
2016-03-03 13:18:10 +01:00
|
|
|
loading.Opt('username',
|
|
|
|
deprecated=[loading.Opt('user-name')],
|
2015-08-03 09:32:56 +10:00
|
|
|
help='Username to login with'),
|
2016-03-03 13:18:10 +01:00
|
|
|
loading.Opt('user-id', help='User ID to login with'),
|
2016-07-07 10:06:52 +10:00
|
|
|
loading.Opt('password',
|
|
|
|
secret=True,
|
|
|
|
prompt='Password: ',
|
|
|
|
help='Password to use'),
|
2015-08-03 09:32:56 +10:00
|
|
|
])
|
|
|
|
|
|
|
|
return options
|