summaryrefslogtreecommitdiffstats
path: root/Monitoring/MonitoringService/Resource/resource.py
blob: fb093bdd98e9b5cf115fb5a42a1899fe9bfc1220 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'''
Created on May 31, 2012

@author: steger
'''

class resource(object):
    def __init__(self, name = None, resourceid = None):
        self._name = name
        self._resourceid = resourceid

    @staticmethod
    def ipret(x):
        if not x:
            return None
        x = str(x)
        if len(x):
            return x
        else:
            return None

    @property
    def name(self):
        if self._name is None:
            raise Exception("resource name is not set")
        return self._name
    @name.setter
    def name(self, name):
        self._name = self.ipret(name)
    @name.deleter
    def name(self):
        self._name = None

    @property
    def resourceid(self):
        if self._resourceid is None:
            raise Exception("resource id is not set")
        return self._resourceid
    @resourceid.setter
    def resourceid(self, resourceid):
        self._resourceid = resourceid
    @resourceid.deleter
    def resourceid(self):
        self._resourceid = None