Example #1
0
class Profile(resource.Resource):
    resource_key = 'profile'
    resources_key = 'profiles'
    base_path = '/profiles'
    service = cluster_service.ClusterService()

    # capabilities
    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True

    patch_update = True

    _query_mapping = resource.QueryParameters('sort', 'global_project', 'type',
                                              'name')

    # Bodyerties
    #: The name of the profile
    name = resource.Body('name')
    #: The type of the profile.
    type = resource.Body('type')
    #: The ID of the project this profile belongs to.
    project_id = resource.Body('project')
    #: The ID of the user who created this profile.
    user_id = resource.Body('user')
    #: The spec of the profile.
    spec = resource.Body('spec', type=dict)
    #: A collection of key-value pairs that are attached to the profile.
    metadata = resource.Body('metadata', type=dict)
    #: Timestamp of when the profile was created.
    created_at = resource.Body('created_at')
    #: Timestamp of when the profile was last updated.
    updated_at = resource.Body('updated_at')
class ClusterPolicy(resource.Resource):
    id_attribute = 'policy_id'
    resource_key = 'cluster_policy'
    resources_key = 'cluster_policies'
    base_path = '/clusters/%(cluster_id)s/policies'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    #: ID of the policy object.
    policy_id = resource.prop('policy_id')
    #: Name of the policy object.
    policy_name = resource.prop('policy_name')
    #: ID of the cluster object.
    cluster_id = resource.prop('cluster_id')
    #: Name of the cluster object.
    cluster_name = resource.prop('cluster_name')
    #: Type string of the policy.
    policy_type = resource.prop('policy_type')
    #: Relative priority of the policy among those attached to the cluster.
    priority = resource.prop('priority')
    #: Enforcement levle of the policy on the cluster.
    level = resource.prop('level', type=int)
    #: Cooldown in seconds for the policy.
    cooldown = resource.prop('cooldown')
    #: Whether the policy is enabled on the cluster.
    enabled = resource.prop('enabled')
    #: Data associated with the cluster-policy binding.
    data = resource.prop('data', type=dict)
Example #3
0
class Receiver(resource.Resource):
    resource_key = 'receiver'
    resources_key = 'receivers'
    base_path = '/receivers'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True
    allow_create = True
    allow_delete = True

    # Properties
    id = resource.prop('id')
    user = resource.prop('user')
    project = resource.prop('project')
    domain = resource.prop('domain')
    name = resource.prop('name')
    type = resource.prop('type')
    cluster_id = resource.prop('cluster_id')
    action = resource.prop('action')
    created_at = resource.prop('created_at')
    actor = resource.prop('actor', type=dict)
    params = resource.prop('params', type=dict)
    channel = resource.prop('channel', type=dict)
Example #4
0
class ClusterPolicy(resource.Resource):
    id_attribute = 'policy_id'
    resource_key = 'cluster_policy'
    resources_key = 'cluster_policies'
    base_path = '/clusters/%(cluster_id)s/policies'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    #: ID of the policy object.
    policy_id = resource.prop('policy_id')
    #: Name of the policy object.
    policy_name = resource.prop('policy_name')
    #: ID of the cluster object.
    cluster_id = resource.prop('cluster_id')
    #: Name of the cluster object.
    cluster_name = resource.prop('cluster_name')
    #: Type string of the policy.
    policy_type = resource.prop('policy_type')
    #: Whether the policy is enabled on the cluster.
    enabled = resource.prop('enabled')
    #: Data associated with the cluster-policy binding.
    data = resource.prop('data', type=dict)
class Event(resource.Resource):
    resource_key = 'event'
    resources_key = 'events'
    base_path = '/events'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    #: Timestamp string (in ISO8601 format) when the event was generated.
    generated_at = resource.prop('timestamp')
    #: The UUID of the object related to this event.
    obj_id = resource.prop('oid')
    #: The name of the object related to this event.
    obj_name = resource.prop('oname')
    #: The type name of the object related to this event.
    obj_type = resource.prop('otype')
    #: The UUID of the cluster related to this event, if any.
    cluster_id = resource.prop('cluster_id')
    #: The event level (priority).
    level = resource.prop('level')
    #: The ID of the user.
    user_id = resource.prop('user')
    #: The ID of the project (tenant).
    project_id = resource.prop('project')
    #: The string representation of the action associated with the event.
    action = resource.prop('action')
    #: The status of the associated object.
    status = resource.prop('status')
    #: A string description of the reason that brought the object into its
    #: current status.
    status_reason = resource.prop('status_reason')
Example #6
0
class ClusterPolicy(resource.Resource):
    resource_key = 'cluster_policy'
    resources_key = 'cluster_policies'
    base_path = '/clusters/%(cluster_id)s/policies'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_get = True

    _query_mapping = resource.QueryParameters('sort',
                                              'policy_name',
                                              'policy_type',
                                              is_enabled='enabled')

    # Properties
    #: ID of the policy object.
    policy_id = resource.Body('policy_id', alternate_id=True)
    #: Name of the policy object.
    policy_name = resource.Body('policy_name')
    #: ID of the cluster object.
    cluster_id = resource.URI('cluster_id')
    #: Name of the cluster object.
    cluster_name = resource.Body('cluster_name')
    #: Type string of the policy.
    policy_type = resource.Body('policy_type')
    #: Whether the policy is enabled on the cluster. *Type: bool*
    is_enabled = resource.Body('enabled', type=bool)
    #: Data associated with the cluster-policy binding.
    data = resource.Body('data', type=dict)
Example #7
0
class Profile(resource.Resource):
    resource_key = 'profile'
    resources_key = 'profiles'
    base_path = '/profiles'
    service = cluster_service.ClusterService()

    # capabilities
    allow_create = True
    allow_retrieve = True
    allow_update = True
    allow_delete = True
    allow_list = True

    patch_update = True

    # properties
    #: The name of the profile
    name = resource.prop('name')
    #: The type of the profile.
    type_name = resource.prop('type')
    #: The spec of the profile.
    spec = resource.prop('spec', type=dict)
    #: A collection of key-value pairs that are attached to the profile.
    metadata = resource.prop('metadata', type=dict)
    #: Timestamp of when the profile was created.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    created_at = resource.prop('created_at', type=format.ISO8601)
    #: Timestamp of when the profile was last updated.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    updated_at = resource.prop('updated_at', type=format.ISO8601)
Example #8
0
class Policy(resource.Resource):
    resource_key = 'policy'
    resources_key = 'policies'
    base_path = '/policies'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True
    allow_create = True
    allow_delete = True
    allow_update = True

    patch_update = True

    # Properties
    #: The name of the policy.
    name = resource.prop('name')
    #: The type name of the policy.
    type = resource.prop('type')
    #: The default cooldown time in seconds.
    cooldown = resource.prop('cooldown', type=int)
    #: The default enforcement level of the policy (0-100).
    level = resource.prop('level', type=int)
    #: The timestamp when the policy is created.
    created_at = resource.prop('created_time')
    #: The timestamp when the policy was last updated.
    updated_at = resource.prop('updated_time')
    #: The timestamp when the poicy was deleted.
    deleted_at = resource.prop('deleted_time')
    #: The specification of the policy.
    spec = resource.prop('spec', type=dict)
    #: A dictionary containing runtime data of the policy.
    data = resource.prop('data', type=dict)
Example #9
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())
Example #10
0
class Profile(resource.Resource):
    resource_key = 'profile'
    resources_key = 'profiles'
    base_path = '/profiles'
    service = cluster_service.ClusterService()

    # capabilities
    allow_create = True
    allow_retrieve = True
    allow_update = True
    allow_delete = True
    allow_list = True

    patch_update = True

    # properties
    #: The name of the profile
    name = resource.prop('name')
    #: The type of the profile.
    type_name = resource.prop('type')
    #: The permission string of the profile.
    permission = resource.prop('permission')
    #: The spec of the profile.
    spec = resource.prop('spec', type=dict)
    #: A collection of key-value pairs that are attached to the profile.
    metadata = resource.prop('metadata', type=dict)
    #: Timestamp of when the profile was created.
    created_at = resource.prop('created_time')
    #: Timestamp of when the profile was last updated.
    updated_at = resource.prop('updated_time')
    #: Timestamp of when the profile was deleted. This is only used on
    #: profiles that were soft-deleted.
    deleted_at = resource.prop('deleted_time')
Example #11
0
class Policy(resource.Resource):
    resource_key = 'policy'
    resources_key = 'policies'
    base_path = '/policies'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_get = True
    allow_create = True
    allow_delete = True
    allow_update = True

    patch_update = True

    _query_mapping = resource.QueryParameters('name', 'type', 'sort',
                                              'global_project')

    # Properties
    #: The name of the policy.
    name = resource.Body('name')
    #: The type name of the policy.
    type = resource.Body('type')
    #: The ID of the project this policy belongs to.
    project_id = resource.Body('project')
    #: The ID of the user who created this policy.
    user_id = resource.Body('user')
    #: The timestamp when the policy is created.
    created_at = resource.Body('created_at')
    #: The timestamp when the policy was last updated.
    updated_at = resource.Body('updated_at')
    #: The specification of the policy.
    spec = resource.Body('spec', type=dict)
    #: A dictionary containing runtime data of the policy.
    data = resource.Body('data', type=dict)
class Policy(resource.Resource):
    resource_key = 'policy'
    resources_key = 'policies'
    base_path = '/policies'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True
    allow_create = True
    allow_delete = True
    allow_update = True

    patch_update = True

    # Properties
    #: The name of the policy.
    name = resource.prop('name')
    #: The type name of the policy.
    type = resource.prop('type')
    #: The timestamp when the policy is created.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    created_at = resource.prop('created_at', type=format.ISO8601)
    #: The timestamp when the policy was last updated.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    updated_at = resource.prop('updated_at', type=format.ISO8601)
    #: The specification of the policy.
    spec = resource.prop('spec', type=dict)
    #: A dictionary containing runtime data of the policy.
    data = resource.prop('data', type=dict)
Example #13
0
class ClusterPolicy(resource.Resource):
    id_attribute = 'policy_id'
    resource_key = 'cluster_policy'
    resources_key = 'cluster_policies'
    base_path = '/clusters/%(cluster_id)s/policies'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    policy_id = resource.prop('policy_id')
    cluster_id = resource.prop('cluster_id')
    cluster_name = resource.prop('cluster_name')
    policy = resource.prop('policy_name')
    type = resource.prop('policy_type')
    priority = resource.prop('priority')
    level = resource.prop('level', type=int)
    cooldown = resource.prop('cooldown')
    enabled = resource.prop('enabled')

    def to_dict(self):
        info = {
            'cluster_id': self.cluster_id,
            'cluster_name': self.cluster_name,
            'policy_id': self.policy_id,
            'policy': self.policy,
            'type': self.type,
            'priority': self.priority,
            'level': self.level,
            'cooldown': self.cooldown,
            'enabled': self.enabled,
        }
        return info
Example #14
0
 def test_service(self):
     sot = cluster_service.ClusterService()
     self.assertEqual('clustering', 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)
Example #15
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())
class Action(resource.Resource):
    resource_key = 'action'
    resources_key = 'actions'
    base_path = '/actions'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_get = True

    _query_mapping = resource.QueryParameters(
        'name', 'action', 'status', 'sort', 'global_project',
        target_id='target')

    # Properties
    #: Name of the action.
    name = resource.Body('name')
    #: ID of the target object, which can be a cluster or a node.
    target_id = resource.Body('target')
    #: Built-in type name of action.
    action = resource.Body('action')
    #: A string representation of the reason why the action was created.
    cause = resource.Body('cause')
    #: The owning engine that is currently running the action.
    owner_id = resource.Body('owner')
    #: The ID of the user who created this action.
    user_id = resource.Body('user')
    #: The ID of the project this profile belongs to.
    project_id = resource.Body('project')
    #: The domain ID of the action.
    domain_id = resource.Body('domain')
    #: Interval in seconds between two consecutive executions.
    interval = resource.Body('interval')
    #: The time the action was started.
    start_at = resource.Body('start_time')
    #: The time the action completed execution.
    end_at = resource.Body('end_time')
    #: The timeout in seconds.
    timeout = resource.Body('timeout')
    #: Current status of the action.
    status = resource.Body('status')
    #: A string describing the reason that brought the action to its current
    #  status.
    status_reason = resource.Body('status_reason')
    #: A dictionary containing the inputs to the action.
    inputs = resource.Body('inputs', type=dict)
    #: A dictionary containing the outputs to the action.
    outputs = resource.Body('outputs', type=dict)
    #: A list of actions that must finish before this action starts execution.
    depends_on = resource.Body('depends_on', type=list)
    #: A list of actions that can start only after this action has finished.
    depended_by = resource.Body('depended_by', type=list)
    #: Timestamp when the action is created.
    created_at = resource.Body('created_at')
    #: Timestamp when the action was last updated.
    updated_at = resource.Body('updated_at')
class BuildInfo(resource.Resource):
    base_path = '/build-info'
    resource_key = 'build_info'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_retrieve = True

    # Properties
    api = resource.prop('api')
    engine = resource.prop('engine')
Example #18
0
class BuildInfo(resource.Resource):
    base_path = '/build-info'
    resource_key = 'build_info'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_get = True

    # Properties
    #: String representation of the API build version
    api = resource.Body('api')
    #: String representation of the engine build version
    engine = resource.Body('engine')
Example #19
0
class Version(resource.Resource):
    resource_key = 'version'
    resources_key = 'versions'
    base_path = '/'
    service = cluster_service.ClusterService(
        version=cluster_service.ClusterService.UNVERSIONED)

    # capabilities
    allow_list = True

    # Properties
    links = resource.prop('links')
    status = resource.prop('status')
Example #20
0
    def __init__(self, plugins=None):
        """User preference for each service.

        :param 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._services = {}

        self._add_service(anti_ddos_service.AntiDDosService(version="v1"))
        self._add_service(alarm_service.AlarmService(version="v2"))
        self._add_service(bare_metal_service.BareMetalService(version="v1"))
        self._add_service(block_store_service.BlockStoreService(version="v2"))
        self._add_service(cluster_service.ClusterService(version="v1"))
        self._add_service(compute_service.ComputeService(version="v2"))
        self._add_service(cts_service.CTSService(version="v1"))
        self._add_service(database_service.DatabaseService(version="v1"))
        self._add_service(dms_service.DMSService(version="v1"))
        self._add_service(identity_service.IdentityService(version="v3"))
        self._add_service(image_service.ImageService(version="v2"))
        self._add_service(key_manager_service.KeyManagerService(version="v1"))
        self._add_service(kms_service.KMSService(version="v1"))
        self._add_service(lb_service.LoadBalancerService(version="v1"))
        self._add_service(maas_service.MaaSService(version="v1"))
        self._add_service(message_service.MessageService(version="v1"))
        self._add_service(network_service.NetworkService(version="v2"))
        self._add_service(
            object_store_service.ObjectStoreService(version="v1"))
        self._add_service(
            orchestration_service.OrchestrationService(version="v1"))
        self._add_service(rds_service.RDSService(version="v1"))
        self._add_service(rds_os_service.RDSService(version="v1"))
        self._add_service(smn_service.SMNService(version="v2"))
        self._add_service(telemetry_service.TelemetryService(version="v2"))
        self._add_service(workflow_service.WorkflowService(version="v2"))
        # QianBiao.NG HuaWei Services
        self._add_service(dns_service.DNSService(version="v2"))
        self._add_service(cloud_eye_service.CloudEyeService(version="v1"))
        ass = auto_scaling_service.AutoScalingService(version="v1")
        self._add_service(ass)
        vbs_v2 = volume_backup_service.VolumeBackupService(version="v2")
        self._add_service(vbs_v2)
        self._add_service(map_reduce_service.MapReduceService(version="v1"))

        if plugins:
            for plugin in plugins:
                self._load_plugin(plugin)
        self.service_keys = sorted(self._services.keys())
class Action(resource.Resource):
    resource_key = 'action'
    resources_key = 'actions'
    base_path = '/actions'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    #: Name of the action.
    name = resource.prop('name')
    #: ID of the target object, which can be a cluster or a node.
    target_id = resource.prop('target')
    #: Built-in type name of action.
    action = resource.prop('action')
    #: A string representation of the reason why the action was created.
    cause = resource.prop('cause')
    #: The owning engine that is currently running the action.
    owner_id = resource.prop('owner')
    #: Interval in seconds between two consecutive executions.
    interval = resource.prop('interval')
    #: The time the action was started.
    #: *Type: datetime object parsed from a UNIX epoch*
    start_at = resource.prop('start_time', type=format.UNIXEpoch)
    #: The time the action completed execution.
    #: *Type: datetime object parsed from a UNIX epoch*
    end_at = resource.prop('end_time', type=format.UNIXEpoch)
    #: The timeout in seconds.
    timeout = resource.prop('timeout')
    #: Current status of the action.
    status = resource.prop('status')
    #: A string describing the reason that brought the action to its current
    #  status.
    status_reason = resource.prop('status_reason')
    #: A dictionary containing the inputs to the action.
    inputs = resource.prop('inputs', type=dict)
    #: A dictionary containing the outputs to the action.
    outputs = resource.prop('outputs', type=dict)
    #: A list of actions that must finish before this action starts execution.
    depends_on = resource.prop('depends_on', type=list)
    #: A list of actions that can start only after this action has finished.
    depended_by = resource.prop('depended_by', type=list)
    #: Timestamp when the action is created.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    created_at = resource.prop('created_at', type=format.ISO8601)
    #: Timestamp when the action was last updated.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    updated_at = resource.prop('updated_at', type=format.ISO8601)
class Receiver(resource.Resource):
    resource_key = 'receiver'
    resources_key = 'receivers'
    base_path = '/receivers'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_get = True
    allow_create = True
    allow_update = True
    allow_delete = True

    patch_update = True

    _query_mapping = resource.QueryParameters('name',
                                              'type',
                                              'cluster_id',
                                              'action',
                                              'sort',
                                              'global_project',
                                              user_id='user')

    # Properties
    #: The name of the receiver.
    name = resource.Body('name')
    #: The type of the receiver.
    type = resource.Body('type')
    #: The ID of the user who created the receiver, thus the owner of it.
    user_id = resource.Body('user')
    #: The ID of the project this receiver belongs to.
    project_id = resource.Body('project')
    #: The domain ID of the receiver.
    domain_id = resource.Body('domain')
    #: The ID of the targeted cluster.
    cluster_id = resource.Body('cluster_id')
    #: The name of the targeted action.
    action = resource.Body('action')
    #: Timestamp of when the receiver was created.
    created_at = resource.Body('created_at')
    #: Timestamp of when the receiver was last updated.
    updated_at = resource.Body('updated_at')
    #: The credential of the impersonated user.
    actor = resource.Body('actor', type=dict)
    #: A dictionary containing key-value pairs that are provided to the
    #: targeted action.
    params = resource.Body('params', type=dict)
    #: The information about the channel through which you can trigger the
    #: receiver hence the associated action.
    channel = resource.Body('channel', type=dict)
Example #23
0
class PolicyType(resource.Resource):
    resource_key = 'policy_type'
    resources_key = 'policy_types'
    base_path = '/policy-types'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_get = True

    # Properties
    #: Name of policy type.
    name = resource.Body('name', alternate_id=True)
    #: The schema of the policy type.
    schema = resource.Body('schema')
Example #24
0
class Action(resource.Resource):
    resource_key = 'action'
    resources_key = 'actions'
    base_path = '/actions'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    id = resource.prop('id')
    name = resource.prop('name')
    target = resource.prop('target')
    action = resource.prop('action')
    cause = resource.prop('cause')
    owner = resource.prop('owner')
    interval = resource.prop('interval')
    start_time = resource.prop('start_time')
    end_time = resource.prop('end_time')
    timeout = resource.prop('timeout')
    status = resource.prop('status')
    status_reason = resource.prop('status_reason')
    inputs = resource.prop('inputs', type=dict)
    outputs = resource.prop('outputs', type=dict)
    depends_on = resource.prop('depends_on', type=list)
    depended_by = resource.prop('depended_by', type=list)

    def to_dict(self):
        action_dict = {
            'id': self.id,
            'name': self.name,
            'action': self.action,
            'target': self.target,
            'cause': self.cause,
            'interval': self.interval,
            'start_time': self.start_time,
            'end_time': self.end_time,
            'interval': self.interval,
            'timeout': self.timeout,
            'status': self.status,
            'status_reason': self.status_reason,
            'inputs': self.inputs,
            'outputs': self.outputs,
            'depends_on': self.depends_on,
            'depended_by': self.depended_by,
        }
        return action_dict
Example #25
0
class PolicyType(resource.Resource):
    id_attribute = 'name'
    resource_key = 'policy_type'
    resources_key = 'policy_types'
    base_path = '/policy-types'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    #: Name of policy type.
    name = resource.prop('name')
    #: The schema of the policy type.
    schema = resource.prop('schema')
class ProfileType(resource.Resource):
    resource_key = 'profile_type'
    resources_key = 'profile_types'
    base_path = '/profile-types'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_get = True

    # Properties
    #: Name of the profile type.
    name = resource.Body('name', alternate_id=True)
    #: The schema of the profile type.
    schema = resource.Body('schema')
    #: The support status of the profile type
    support_status = resource.Body('support_status')
class ClusterAttr(resource.Resource):
    resources_key = 'cluster_attributes'
    base_path = '/clusters/%(cluster_id)s/attrs/%(path)s'
    service = cluster_service.ClusterService()

    # capabilities
    allow_list = True

    # Properties
    #: The identity of the cluster
    cluster_id = resource.URI('cluster_id')
    #: The json path string for attribute retrieval
    path = resource.URI('path')
    #: The id of the node that carries the attribute value.
    node_id = resource.Body('id')
    #: The value of the attribute requested.
    attr_value = resource.Body('value')
Example #28
0
class Receiver(resource.Resource):
    resource_key = 'receiver'
    resources_key = 'receivers'
    base_path = '/receivers'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True
    allow_create = True
    allow_delete = True

    # Properties
    #: The name of the receiver.
    name = resource.prop('name')
    #: The type of the receiver.
    type = resource.prop('type')
    #: The ID of the user who created the receiver, thus the owner of it.
    user_id = resource.prop('user')
    #: The ID of the project this receiver belongs to.
    project_id = resource.prop('project')
    #: The domain ID of the receiver.
    domain_id = resource.prop('domain')
    #: The ID of the targeted cluster.
    cluster_id = resource.prop('cluster_id')
    #: The name of the targeted action.
    action = resource.prop('action')
    #: Timestamp of when the receiver was created.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    created_at = resource.prop('created_at', type=format.ISO8601)
    #: Timestamp of when the receiver was last updated.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    updated_at = resource.prop('updated_at', type=format.ISO8601)
    #: The credential of the impersonated user.
    actor = resource.prop('actor', type=dict)
    #: A dictionary containing key-value pairs that are provided to the
    #: targeted action.
    params = resource.prop('params', type=dict)
    #: The information about the channel through which you can trigger the
    #: receiver hence the associated action.
    channel = resource.prop('channel', type=dict)
Example #29
0
class Event(resource.Resource):
    resource_key = 'event'
    resources_key = 'events'
    base_path = '/events'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    id = resource.prop('id')
    timestamp = resource.prop('timestamp')
    obj_id = resource.prop('obj_id')
    obj_name = resource.prop('obj_name')
    obj_type = resource.prop('obj_type')
    cluster_id = resource.prop('cluster_id')
    level = resource.prop('level')
    user = resource.prop('user')
    project = resource.prop('project')
    action = resource.prop('action')
    status = resource.prop('status')
    status_reason = resource.prop('status_reason')

    def to_dict(self):
        event_dict = {
            'id': self.id,
            'timestamp': self.timestamp,
            'obj_id': self.obj_id,
            'obj_type': self.obj_type,
            'obj_name': self.obj_name,
            'cluster_id': self.cluster_id,
            'level': self.level,
            'user': self.user,
            'project': self.project,
            'action': self.action,
            'status': self.status,
            'status_reason': self.status_reason,
        }
        return event_dict
Example #30
0
class Event(resource.Resource):
    resource_key = 'event'
    resources_key = 'events'
    base_path = '/events'
    service = cluster_service.ClusterService()

    # Capabilities
    allow_list = True
    allow_retrieve = True

    # Properties
    id = resource.prop('id')
    timestamp = resource.prop('timestamp')
    obj_id = resource.prop('obj_id')
    obj_name = resource.prop('obj_name')
    obj_type = resource.prop('obj_type')
    cluster_id = resource.prop('cluster_id')
    level = resource.prop('level')
    user_id = resource.prop('user')
    project_id = resource.prop('project')
    action = resource.prop('action')
    status = resource.prop('status')
    status_reason = resource.prop('status_reason')