Exemplo n.º 1
0
class Generic(resource.Resource):
    base_path = '/resource/generic'
    service = metric_service.MetricService()

    # Supported Operations
    allow_create = True
    allow_retrieve = True
    allow_delete = True
    allow_list = True
    allow_update = True

    # Properties
    id = resource.prop('id', alias="resource_id")
    created_by_user_id = resource.prop('created_by_user_id')
    created_by_project_id = resource.prop('created_by_project_id')
    user_id = resource.prop('user_id')
    project_id = resource.prop('project_id')
    started_at = resource.prop('started_at',
                               type=resource_types.ISO8601Datetime)
    ended_at = resource.prop('ended_at', type=resource_types.ISO8601Datetime)
    metrics = resource.prop('metrics', type=dict)

    def create(self, session):
        resp = self.create_by_id(session, self._attrs, None, path_args=self)
        self._attrs[self.id_attribute] = resp[self.id_attribute]
        self._reset_dirty()
        return self
Exemplo n.º 2
0
class Generic(resource.Resource):
    base_path = '/resource/generic'
    service = metric_service.MetricService()

    # Supported Operations
    allow_create = True
    allow_retrieve = True
    allow_delete = True
    allow_list = True
    allow_update = True

    # Properties
    #: The identifier of this resource
    id = resource.prop('id', alias="resource_id")
    #: The ID of the user who created this resource
    created_by_user_id = resource.prop('created_by_user_id')
    #: The ID of the project this resource was created under
    created_by_project_id = resource.prop('created_by_project_id')
    #: The ID of the user
    user_id = resource.prop('user_id')
    #: The ID of the project
    project_id = resource.prop('project_id')
    #: Timestamp when this resource was started
    started_at = resource.prop('started_at',
                               type=resource_types.ISO8601Datetime)
    #: Timestamp when this resource was ended
    ended_at = resource.prop('ended_at', type=resource_types.ISO8601Datetime)
    #: A dictionary of metrics collected on this resource
    metrics = resource.prop('metrics', type=dict)

    def create(self, session):
        resp = self.create_by_id(session, self._attrs)
        self._attrs[self.id_attribute] = resp[self.id_attribute]
        self._reset_dirty()
        return self
Exemplo n.º 3
0
    def __init__(self, plugins=None):
        """User preference for each service.

        :param list plugins: List of entry point namespaces to load.

        Create a new :class:`~openstack.profile.Profile`
        object with no preferences defined, but knowledge of the services.
        Services are identified by their service type, e.g.: 'identity',
        'compute', etc.
        """
        self._preferences = {}
        self._services = {}
        self._add_service(cluster_service.ClusterService())
        self._add_service(compute_service.ComputeService())
        self._add_service(database_service.DatabaseService())
        self._add_service(identity_service.IdentityService())
        self._add_service(image_service.ImageService())
        self._add_service(metric_service.MetricService())
        self._add_service(network_service.NetworkService())
        self._add_service(object_store_service.ObjectStoreService())
        self._add_service(orchestration_service.OrchestrationService())
        self._add_service(key_management_service.KeyManagementService())
        self._add_service(telemetry_service.TelemetryService())
        self._add_service(block_store_service.BlockStoreService())
        self._add_service(message_service.MessageService())

        if plugins:
            for plugin in plugins:
                self._load_plugin(plugin)
        self.service_names = sorted(self._services.keys())
Exemplo n.º 4
0
class Generic(resource.Resource):
    base_path = '/resource/generic'
    service = metric_service.MetricService()

    # Supported Operations
    allow_create = True
    allow_get = True
    allow_delete = True
    allow_list = True
    allow_update = True

    # Properties
    #: The identifier of this resource
    id = resource.Body('id')
    #: The ID of the user who created this resource
    created_by_user_id = resource.Body('created_by_user_id')
    #: The ID of the project this resource was created under
    created_by_project_id = resource.Body('created_by_project_id')
    #: The ID of the user
    user_id = resource.Body('user_id')
    #: The ID of the project
    project_id = resource.Body('project_id')
    #: Timestamp when this resource was started
    started_at = resource.Body('started_at')
    #: Timestamp when this resource was ended
    ended_at = resource.Body('ended_at')
    #: A dictionary of metrics collected on this resource
    metrics = resource.Body('metrics', type=dict)
    #: The type of resource
    type = resource.Body('type')
Exemplo n.º 5
0
class Capabilities(resource.Resource):
    base_path = '/capabilities'
    service = metric_service.MetricService()

    # Supported Operations
    allow_retrieve = True

    #: The supported methods of aggregation.
    aggregation_methods = resource.prop('aggregation_methods', type=list)
 def test_service(self):
     sot = metric_service.MetricService()
     self.assertEqual('metric', sot.service_type)
     self.assertEqual('public', sot.visibility)
     self.assertIsNone(sot.region)
     self.assertIsNone(sot.service_name)
     self.assertEqual(1, len(sot.valid_versions))
     self.assertEqual('v1', sot.valid_versions[0].module)
     self.assertEqual('v1', sot.valid_versions[0].path)
Exemplo n.º 7
0
    def __init__(self):
        """Preferences for each service.

        Create a new :class:`~openstack.profile.Profile`
        object with no preferences defined, but knowledge of the services.
        Services are identified by their service type, e.g.: 'identity',
        'compute', etc.
        """
        self._preferences = {}
        self._services = {}
        """
        NOTE(thowe): We should probably do something more clever here rather
        than brute force create all the services.  Maybe use entry points
        or something, but I'd like to leave that work for another commit.
        """
        serv = cluster_service.ClusterService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = compute_service.ComputeService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = database_service.DatabaseService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = identity_service.IdentityService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = image_service.ImageService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = metric_service.MetricService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = network_service.NetworkService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = object_store_service.ObjectStoreService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = orchestration_service.OrchestrationService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = keystore_service.KeystoreService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = telemetry_service.TelemetryService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = block_store_service.BlockStoreService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = message_service.MessageService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv

        self.service_names = sorted(self._services.keys())
Exemplo n.º 8
0
class Metric(resource.Resource):
    base_path = '/metric'
    service = metric_service.MetricService()

    # Supported Operations
    allow_create = True
    allow_retrieve = True
    allow_delete = True
    allow_list = True

    # Properties
    archive_policy_name = resource.prop('archive_policy_name')
    archive_policy = resource.prop('archive_policy')
    created_by_user_id = resource.prop('created_by_user_id')
    created_by_project_id = resource.prop('created_by_project_id')
    resource_id = resource.prop('resource_id')
    name = resource.prop('name')
Exemplo n.º 9
0
class ArchivePolicy(resource.Resource):
    base_path = '/archive_policy'
    service = metric_service.MetricService()

    # Supported Operations
    allow_create = True
    allow_get = True
    allow_delete = True
    allow_list = True

    # Properties
    #: The name of this policy
    name = resource.Body('name', alternate_id=True)
    #: The definition of this policy
    definition = resource.Body('definition', type=list)
    #: The window of time older than the period that archives can be requested
    back_window = resource.Body('back_window')
    #: A list of the aggregation methods supported
    aggregation_methods = resource.Body("aggregation_methods", type=list)
Exemplo n.º 10
0
class Metric(resource.Resource):
    base_path = '/metric'
    service = metric_service.MetricService()

    # Supported Operations
    allow_create = True
    allow_get = True
    allow_delete = True
    allow_list = True

    # Properties
    #: The name of the archive policy
    archive_policy_name = resource.Body('archive_policy_name')
    #: The archive policy
    archive_policy = resource.Body('archive_policy')
    #: The ID of the user who created this metric
    created_by_user_id = resource.Body('created_by_user_id')
    #: The ID of the project this metric was created under
    created_by_project_id = resource.Body('created_by_project_id')
    #: The identifier of this metric
    resource_id = resource.Body('resource_id')
    #: The name of this metric
    name = resource.Body('name')