当前位置: 首页>>代码示例>>Python>>正文


Python common.check_for_exceptions函数代码示例

本文整理汇总了Python中troveclient.common.check_for_exceptions函数的典型用法代码示例。如果您正苦于以下问题:Python check_for_exceptions函数的具体用法?Python check_for_exceptions怎么用?Python check_for_exceptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_for_exceptions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _log_action

    def _log_action(self, instance, log_name, enable=None, disable=None,
                    publish=None, discard=None):
        """Perform action on guest log.

        :param instance: The :class:`Instance` (or its ID) of the database
                         instance to get the log for.
        :param log_name: The name of <log> to publish
        :param enable: Turn on <log>
        :param disable: Turn off <log>
        :param publish: Publish log to associated container
        :param discard: Delete the associated container
        :rtype: List of :class:`DatastoreLog`.
        """
        body = {"name": log_name}
        if enable:
            body.update({'enable': int(enable)})
        if disable:
            body.update({'disable': int(disable)})
        if publish:
            body.update({'publish': int(publish)})
        if discard:
            body.update({'discard': int(discard)})
        url = "/instances/%s/log" % base.getid(instance)
        resp, body = self.api.client.post(url, body=body)
        common.check_for_exceptions(resp, body, url)
        return DatastoreLog(self, body['log'], loaded=True)
开发者ID:openstack,项目名称:python-troveclient,代码行数:26,代码来源:instances.py

示例2: _action

 def _action(self, host_id, body):
     """
     Perform a host "action" -- update
     """
     url = "/mgmt/hosts/%s/instances/action" % host_id
     resp, body = self.api.client.post(url, body=body)
     common.check_for_exceptions(resp, body, url)
开发者ID:Simplit-openapps,项目名称:python-troveclient,代码行数:7,代码来源:hosts.py

示例3: module_remove

 def module_remove(self, instance, module):
     """Remove a module from an instance.
     """
     url = "/instances/%s/modules/%s" % (base.getid(instance),
                                         base.getid(module))
     resp, body = self.api.client.delete(url)
     common.check_for_exceptions(resp, body, url)
开发者ID:openstack,项目名称:python-troveclient,代码行数:7,代码来源:instances.py

示例4: change_passwords

 def change_passwords(self, instance, users):
     """Change the password for one or more users."""
     instance_id = base.getid(instance)
     user_dict = {"users": users}
     url = "/instances/%s/users" % instance_id
     resp, body = self.api.client.put(url, body=user_dict)
     common.check_for_exceptions(resp, body, url)
开发者ID:Hopebaytech,项目名称:python-troveclient,代码行数:7,代码来源:users.py

示例5: _action

 def _action(self, instance_id, body):
     """
     Perform a server "action" -- reboot/rebuild/resize/etc.
     """
     url = "/mgmt/instances/%s/action" % instance_id
     resp, body = self.api.client.post(url, body=body)
     check_for_exceptions(resp, body)
开发者ID:cp16net,项目名称:python-troveclient,代码行数:7,代码来源:management.py

示例6: create

 def create(self, instance_id, users):
     """
     Create users with permissions to the specified databases
     """
     body = {"users": users}
     url = "/instances/%s/users" % instance_id
     resp, body = self.api.client.post(url, body=body)
     common.check_for_exceptions(resp, body, url)
开发者ID:Simplit-openapps,项目名称:python-troveclient,代码行数:8,代码来源:users.py

示例7: create

 def create(self, instance_id):
     """
     Enable the root user and return the root password for the
     sepcified db instance
     """
     resp, body = self.api.client.post(self.url % instance_id)
     check_for_exceptions(resp, body)
     return body['user']['name'], body['user']['password']
开发者ID:CiscoSystems,项目名称:python-troveclient,代码行数:8,代码来源:root.py

示例8: delete

    def delete(self, configuration):
        """Delete the specified configuration.

        :param configuration: The configuration id to delete
        """
        url = "/configurations/%s" % base.getid(configuration)
        resp, body = self.api.client.delete(url)
        common.check_for_exceptions(resp, body, url)
开发者ID:Tesora,项目名称:tesora-python-troveclient,代码行数:8,代码来源:configurations.py

示例9: delete

    def delete(self, backup_id):
        """Delete the specified backup.

        :param backup_id: The backup id to delete
        """
        url = "/backups/%s" % backup_id
        resp, body = self.api.client.delete(url)
        common.check_for_exceptions(resp, body, url)
开发者ID:B-Rich,项目名称:python-troveclient,代码行数:8,代码来源:backups.py

示例10: _action

 def _action(self, cluster, body):
     """Perform a cluster "action" -- grow/shrink/etc."""
     url = "/clusters/%s" % base.getid(cluster)
     resp, body = self.api.client.post(url, body=body)
     common.check_for_exceptions(resp, body, url)
     if body:
         return self.resource_class(self, body['cluster'], loaded=True)
     return body
开发者ID:HoratiusTang,项目名称:python-troveclient,代码行数:8,代码来源:clusters.py

示例11: delete

    def delete(self, cluster):
        """Delete the specified cluster.

        :param cluster: The cluster to delete
        """
        url = "/clusters/%s" % base.getid(cluster)
        resp, body = self.api.client.delete(url)
        common.check_for_exceptions(resp, body, url)
开发者ID:HoratiusTang,项目名称:python-troveclient,代码行数:8,代码来源:clusters.py

示例12: revoke

 def revoke(self, instance, username, database, hostname=None):
     """Revoke from an existing user access permissions to a database."""
     instance_id = base.getid(instance)
     user = quote_user_host(username, hostname)
     url = "/instances/%(instance_id)s/users/%(user)s/" "databases/%(database)s"
     local_vars = locals()
     resp, body = self.api.client.delete(url % local_vars)
     check_for_exceptions(resp, body)
开发者ID:hub-cap,项目名称:python-troveclient,代码行数:8,代码来源:users.py

示例13: grant

 def grant(self, instance, username, databases, hostname=None):
     """Allow an existing user permissions to access a database."""
     instance_id = base.getid(instance)
     user = quote_user_host(username, hostname)
     url = "/instances/%(instance_id)s/users/%(user)s/databases"
     dbs = {'databases': [{'name': db} for db in databases]}
     resp, body = self.api.client.put(url % locals(), body=dbs)
     check_for_exceptions(resp, body)
开发者ID:krast,项目名称:python-troveclient,代码行数:8,代码来源:users.py

示例14: create

 def create(self, instance_id, databases):
     """
     Create new databases within the specified instance
     """
     body = {"databases": databases}
     url = "/instances/%s/databases" % instance_id
     resp, body = self.api.client.post(url, body=body)
     check_for_exceptions(resp, body)
开发者ID:CiscoSystems,项目名称:python-troveclient,代码行数:8,代码来源:databases.py

示例15: delete

    def delete(self, security_group_rule):
        """Delete the specified security group rule.

        :param security_group_rule: The security group rule to delete
        """
        url = "/security-group-rules/%s" % base.getid(security_group_rule)
        resp, body = self.api.client.delete(url)
        common.check_for_exceptions(resp, body, url)
开发者ID:B-Rich,项目名称:python-troveclient,代码行数:8,代码来源:security_groups.py


注:本文中的troveclient.common.check_for_exceptions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。