本文整理汇总了Python中trove.extensions.common.models.load_and_verify函数的典型用法代码示例。如果您正苦于以下问题:Python load_and_verify函数的具体用法?Python load_and_verify怎么用?Python load_and_verify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_and_verify函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: update_attributes
def update_attributes(cls, context, instance_id, username, hostname,
user_attrs):
load_and_verify(context, instance_id)
client = create_guest_client(context, instance_id)
user_changed = user_attrs.get('name')
host_changed = user_attrs.get('host')
validate = guest_models.MySQLUser()
if host_changed:
validate.host = host_changed
if user_changed:
validate.name = user_changed
user = user_changed or username
host = host_changed or hostname
userhost = "%[email protected]%s" % (user, host)
if user_changed or host_changed:
existing_users, _nadda = Users.load_with_client(
client,
limit=1,
marker=userhost,
include_marker=True)
if (len(existing_users) > 0 and
existing_users[0].name == user and
existing_users[0].host == host):
raise exception.UserAlreadyExists(name=user,
host=host)
client.update_attributes(username, hostname, user_attrs)
开发者ID:Hopebaytech,项目名称:trove,代码行数:29,代码来源:models.py
示例2: load_via_context
def load_via_context(cls, context, instance_id):
"""Creates guest and fetches pagination arguments from the context."""
load_and_verify(context, instance_id)
limit = utils.pagination_limit(context.limit, cls.DEFAULT_LIMIT)
client = create_guest_client(context, instance_id)
# The REST API standard dictates that we *NEVER* include the marker.
return cls.load_with_client(client=client, limit=limit,
marker=context.marker, include_marker=False)
开发者ID:Hopebaytech,项目名称:trove,代码行数:8,代码来源:models.py
示例3: access
def access(cls, context, instance_id, username, hostname):
load_and_verify(context, instance_id)
client = create_guest_client(context, instance_id)
databases = client.list_access(username, hostname)
dbs = []
for db in databases:
dbs.append(Schema(name=db['_name'],
collate=db['_collate'],
character_set=db['_character_set']))
return UserAccess(dbs)
开发者ID:Hopebaytech,项目名称:trove,代码行数:10,代码来源:models.py
示例4: change_password
def change_password(cls, context, instance_id, users):
load_and_verify(context, instance_id)
client = create_guest_client(context, instance_id)
change_users = []
for user in users:
change_user = {'name': user.name,
'host': user.host,
'password': user.password,
}
change_users.append(change_user)
client.change_passwords(change_users)
开发者ID:Hopebaytech,项目名称:trove,代码行数:11,代码来源:models.py
示例5: create
def create(cls, context, instance_id, schemas):
load_and_verify(context, instance_id)
client = create_guest_client(context, instance_id)
for schema in schemas:
schema_name = schema['_name']
existing_schema, _nadda = Schemas.load_with_client(
client,
limit=1,
marker=schema_name,
include_marker=True)
if (len(existing_schema) > 0 and
str(existing_schema[0].name) == str(schema_name)):
raise exception.DatabaseAlreadyExists(name=schema_name)
return client.create_database(schemas)
开发者ID:Hopebaytech,项目名称:trove,代码行数:14,代码来源:models.py
示例6: load
def load(cls, context, instance_id, username, hostname):
load_and_verify(context, instance_id)
validate = guest_models.MySQLUser()
validate.name = username
validate.host = hostname
client = create_guest_client(context, instance_id)
found_user = client.get_user(username=username, hostname=hostname)
if not found_user:
return None
database_names = [{'name': db['_name']}
for db in found_user['_databases']]
return cls(found_user['_name'],
found_user['_host'],
found_user['_password'],
database_names)
开发者ID:512868516,项目名称:trove,代码行数:15,代码来源:models.py
示例7: delete
def delete(cls, context, instance_id, user):
load_and_verify(context, instance_id)
with StartNotification(context, instance_id=instance_id,
username=user):
create_guest_client(context, instance_id).delete_user(user)
开发者ID:Hopebaytech,项目名称:trove,代码行数:6,代码来源:models.py
示例8: revoke
def revoke(cls, context, instance_id, username, hostname, database):
load_and_verify(context, instance_id)
client = create_guest_client(context, instance_id)
client.revoke_access(username, hostname, database)
开发者ID:Hopebaytech,项目名称:trove,代码行数:4,代码来源:models.py
示例9: grant
def grant(cls, context, instance_id, username, hostname, databases):
load_and_verify(context, instance_id)
client = create_guest_client(context, instance_id)
client.grant_access(username, hostname, databases)
开发者ID:Hopebaytech,项目名称:trove,代码行数:4,代码来源:models.py
示例10: delete
def delete(cls, context, instance_id, user):
load_and_verify(context, instance_id)
create_guest_client(context, instance_id).delete_user(user)
开发者ID:512868516,项目名称:trove,代码行数:3,代码来源:models.py
示例11: create_guest_client
def create_guest_client(self, context, instance_id):
common_utils.load_and_verify(context, instance_id)
return remote.create_guest_client(context, instance_id)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:3,代码来源:service.py
注:本文中的trove.extensions.common.models.load_and_verify函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论