示例#1
0
 def test_make_it(self):
     cfg = config.Config(**DATA)
     self.assertEqual(DATA['tenant'], cfg.tenant)
     self.assertEqual(DATA['scaling_configuration_id'], cfg.id)
     self.assertEqual(DATA['scaling_configuration_name'], cfg.name)
     self.assertIsInstance(cfg.instance_config, config.InstanceConfig)
     self.assertEqual(DATA['create_time'], cfg.create_time)
示例#2
0
    def batch_delete_configs(self, configs):
        """batch delete configs

        :param list configs: The list item value can be the ID of a config
             or a :class:`~openstack.auto_scaling.v2.config.Config` instance.
        """
        config = _config.Config()
        return config.batch_delete(self._session, configs)
示例#3
0
 def test_basic(self):
     cfg = config.Config()
     self.assertEqual('scaling_configuration', cfg.resource_key)
     self.assertEqual('scaling_configurations', cfg.resources_key)
     self.assertEqual('/scaling_configuration', cfg.base_path)
     self.assertEqual('auto-scaling', cfg.service.service_type)
     self.assertTrue(cfg.allow_create)
     self.assertTrue(cfg.allow_get)
     self.assertTrue(cfg.allow_delete)
     self.assertTrue(cfg.allow_list)
示例#4
0
    def create_config(self, name, **attrs):
        """Create a new config from config name and instance-config attributes

        :param name: auto scaling config name
        :param dict attrs: Keyword arguments which will be used to create
                a :class:`~openstack.auto_scaling.v2.config.InstanceConfig`,
                comprised of the properties on the InstanceConfig class.
        :returns: The results of config creation
        :rtype: :class:`~openstack.auto_scaling.v2.config.Config`
        """
        instance_config = _config.InstanceConfig.new(**attrs)
        config = _config.Config(name=name, instance_config=instance_config)
        return config.create(self._session, prepend_key=False)