• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python base.getid函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: test_getid

    def test_getid(self):
        obj = "test"
        r = base.getid(obj)
        self.assertEqual(obj, r)

        test_id = "test_id"
        obj = mock.Mock()
        obj.id = test_id
        r = base.getid(obj)
        self.assertEqual(test_id, r)
开发者ID:jamrok,项目名称:python-troveclient,代码行数:10,代码来源:test_base.py


示例3: modify

 def modify(self, instance, configuration=None):
     body = {
         "instance": {
         }
     }
     if configuration is not None:
         body["instance"]["configuration"] = base.getid(configuration)
     url = "/instances/%s" % base.getid(instance)
     resp, body = self.api.client.put(url, body=body)
     common.check_for_exceptions(resp, body, url)
开发者ID:openstack,项目名称:python-troveclient,代码行数:10,代码来源:instances.py


示例4: create

    def create(self, name, flavor_id, volume=None, databases=None, users=None,
               restorePoint=None, availability_zone=None, datastore=None,
               datastore_version=None, nics=None, configuration=None,
               replica_of=None, slave_of=None, replica_count=None,
               modules=None, locality=None):
        """Create (boot) a new instance."""

        body = {"instance": {
            "name": name,
            "flavorRef": flavor_id
        }}
        datastore_obj = {}
        if volume:
            body["instance"]["volume"] = volume
        if databases:
            body["instance"]["databases"] = databases
        if users:
            body["instance"]["users"] = users
        if restorePoint:
            body["instance"]["restorePoint"] = restorePoint
        if availability_zone:
            body["instance"]["availability_zone"] = availability_zone
        if datastore:
            datastore_obj["type"] = datastore
        if datastore_version:
            datastore_obj["version"] = datastore_version
        if datastore_obj:
            body["instance"]["datastore"] = datastore_obj
        if nics:
            body["instance"]["nics"] = nics
        if configuration:
            body["instance"]["configuration"] = base.getid(configuration)
        if replica_of or slave_of:
            if slave_of:
                warnings.warn(_LW("The 'slave_of' argument is deprecated in "
                                  "favor of 'replica_of' and will be removed "
                                  "after the Trove liberty series is end of "
                                  "life."),
                              category=DeprecationWarning)
            body["instance"]["replica_of"] = base.getid(replica_of) or slave_of
        if replica_count:
            body["instance"]["replica_count"] = replica_count
        if modules:
            body["instance"]["modules"] = self._get_module_list(modules)
        if locality:
            body["instance"]["locality"] = locality

        return self._create("/instances", body, "instance")
开发者ID:Hopebaytech,项目名称:python-troveclient,代码行数:48,代码来源:instances.py


示例5: schedule_create

    def schedule_create(self, instance, pattern, name,
                        description=None, incremental=False,
                        mistral_client=None):
        """Create a new schedule to backup the given instance.

        :param instance: instance to backup.
        :param: pattern: cron pattern for schedule.
        :param name: name for backup.
        :param description: (optional).
        :param incremental: flag for incremental backup (optional).
        :returns: :class:`Backups`
        """

        if not mistral_client:
            mistral_client = self._get_mistral_client()

        inst_id = base.getid(instance)
        cron_name = str(uuid.uuid4())
        wf_input = {"instance": inst_id,
                    "name": name,
                    "description": description,
                    "incremental": incremental
                    }

        cron_trigger = mistral_client.cron_triggers.create(
            cron_name, self.backup_create_workflow, pattern=pattern,
            workflow_input=wf_input)

        return self._build_schedule(cron_trigger, wf_input)
开发者ID:Tesora,项目名称:tesora-python-troveclient,代码行数:29,代码来源:backups.py


示例6: backups

    def backups(self, instance):
        """
        Get the list of backups for a specific instance.

        :rtype: list of :class:`Backups`.
        """
        return self._list("/instances/%s/backups" % base.getid(instance), "backups")
开发者ID:hub-cap,项目名称:python-troveclient,代码行数:7,代码来源:instances.py


示例7: 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


示例8: get

    def get(self, flavor):
        """Get a specific flavor.

        :rtype: :class:`Flavor`
        """
        return self._get("/flavors/%s" % base.getid(flavor),
                         "flavor")
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:7,代码来源:flavors.py


示例9: backups

    def backups(self, instance, limit=None, marker=None):
        """Get the list of backups for a specific instance.

        :rtype: list of :class:`Backups`.
        """
        url = "/instances/%s/backups" % base.getid(instance)
        return self._paginated(url, "backups", limit, marker)
开发者ID:glucas1,项目名称:python-troveclient,代码行数:7,代码来源:instances.py


示例10: get

    def get(self, configuration):
        """Get a specific configuration.

        :rtype: :class:`Configurations`
        """
        return self._get("/configurations/%s" % base.getid(configuration),
                         "configuration")
开发者ID:Tesora,项目名称:tesora-python-troveclient,代码行数:7,代码来源:configurations.py


示例11: get

    def get(self, datastore):
        """Get a specific datastore.

        :rtype: :class:`Datastore`
        """
        return self._get("/datastores/%s" % base.getid(datastore),
                         "datastore")
开发者ID:Hopebaytech,项目名称:python-troveclient,代码行数:7,代码来源:datastores.py


示例12: get

    def get(self, backup):
        """Get a specific backup.

        :rtype: :class:`Backups`
        """
        return self._get("/backups/%s" % base.getid(backup),
                         "backup")
开发者ID:B-Rich,项目名称:python-troveclient,代码行数:7,代码来源:backups.py


示例13: get

    def get(self, cluster):
        """Get a specific cluster.

        :rtype: :class:`Cluster`
        """
        return self._get("/clusters/%s" % base.getid(cluster),
                         "cluster")
开发者ID:HoratiusTang,项目名称:python-troveclient,代码行数:7,代码来源:clusters.py


示例14: create

    def create(self, name, instance, description=None, parent_id=None,
               backup=None, incremental=False):
        """Create a new backup from the given instance.

        :param name: name for backup.
        :param instance: instance to backup.
        :param description: (optional).
        :param parent_id: base for incremental backup (optional).
        :param incremental: flag to indicate incremental backup based on
        last backup
        :returns: :class:`Backups`
        """
        body = {
            "backup": {
                "name": name,
                "incremental": int(incremental)
            }
        }

        if instance:
            body['backup']['instance'] = base.getid(instance)
        if backup:
            body["backup"]['backup'] = backup
        if description:
            body['backup']['description'] = description
        if parent_id:
            body['backup']['parent_id'] = parent_id
        return self._create("/backups", body, "backup")
开发者ID:Tesora,项目名称:tesora-python-troveclient,代码行数:28,代码来源:backups.py


示例15: list

 def list(self, limit=None, marker=None, datastore=None):
     """Get a list of all modules."""
     query_strings = None
     if datastore:
         query_strings = {"datastore": base.getid(datastore)}
     return self._paginated(
         "/modules", "modules", limit, marker, query_strings=query_strings)
开发者ID:Tesora,项目名称:tesora-python-troveclient,代码行数:7,代码来源:modules.py


示例16: list

    def list(self, instance, limit=None, marker=None):
        """Get a list of all Users from the instance's Database.

        :rtype: list of :class:`User`.
        """
        url = "/instances/%s/users" % base.getid(instance)
        return self._paginated(url, "users", limit, marker)
开发者ID:Hopebaytech,项目名称:python-troveclient,代码行数:7,代码来源:users.py


示例17: get

    def get(self, instance):
        """
        Get a specific instances.

        :rtype: :class:`Instance`
        """
        return self._get("/instances/%s" % base.getid(instance), "instance")
开发者ID:hub-cap,项目名称:python-troveclient,代码行数:7,代码来源:instances.py


示例18: _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


示例19: get

    def get(self, security_group):
        """Get a specific security group.

        :rtype: :class:`SecurityGroup`
        """
        return self._get("/security-groups/%s" % base.getid(security_group),
                         "security_group")
开发者ID:B-Rich,项目名称:python-troveclient,代码行数:7,代码来源:security_groups.py


示例20: _get_module_list

 def _get_module_list(self, modules):
     """Build a list of module ids."""
     module_list = []
     for module in modules:
         module_info = {'id': base.getid(module)}
         module_list.append(module_info)
     return module_list
开发者ID:openstack,项目名称:python-troveclient,代码行数:7,代码来源:instances.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python common.check_for_exceptions函数代码示例发布时间:2022-05-27
下一篇:
Python gettextutils._函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap