Esempio n. 1
0
    def get_by_name(cls, context, name):
        """Find a resource provider based on name.

        :param name: the logical name of a resource provider.
        :param context: Security context
        :returns: a :class:`ResourceProvider` object.
        """
        db_provider = dbapi.get_resource_provider(context, name)
        provider = ResourceProvider._from_db_object(cls(context), db_provider)
        return provider
Esempio n. 2
0
    def get_by_uuid(cls, context, uuid):
        """Find a resource provider based on uuid.

        :param uuid: the uuid of a resource provider.
        :param context: Security context
        :returns: a :class:`ResourceProvider` object.
        """
        db_provider = dbapi.get_resource_provider(context, uuid)
        provider = ResourceProvider._from_db_object(cls(context), db_provider)
        return provider
Esempio n. 3
0
    def get_by_name(cls, context, name):
        """Find a resource provider based on name.

        :param name: the logical name of a resource provider.
        :param context: Security context
        :returns: a :class:`ResourceProvider` object.
        """
        db_provider = dbapi.get_resource_provider(context, name)
        provider = ResourceProvider._from_db_object(cls(context), db_provider)
        return provider
Esempio n. 4
0
    def get_by_uuid(cls, context, uuid):
        """Find a resource provider based on uuid.

        :param uuid: the uuid of a resource provider.
        :param context: Security context
        :returns: a :class:`ResourceProvider` object.
        """
        db_provider = dbapi.get_resource_provider(context, uuid)
        provider = ResourceProvider._from_db_object(cls(context), db_provider)
        return provider
Esempio n. 5
0
 def test_get_resource_provider_by_name(self):
     provider = utils.create_test_resource_provider(context=self.context)
     res = dbapi.get_resource_provider(self.context, provider.name)
     self.assertEqual(provider.id, res.id)
     self.assertEqual(provider.uuid, res.uuid)
 def test_get_resource_provider_by_name(self):
     provider = utils.create_test_resource_provider(context=self.context)
     res = dbapi.get_resource_provider(
         self.context, provider.name)
     self.assertEqual(provider.id, res.id)
     self.assertEqual(provider.uuid, res.uuid)