Exemplo n.º 1
0
Arquivo: nodes.py Projeto: chixq/pyk8s
    def newFromDict(data):
        if data is None:
            data = {}

        if not isinstance(data, dict):
            raise PyK8SError('Type dict required')
        else:
            return Nodes(
                resourceVersion=data.get('resourceVersion', None),
                creationTimestamp=data.get('creationTimestamp', None),
                items = [Node.newFromDict(item) for item in (data.get('items',{}) if (data.get('items',{}) is not None) else {})],
                apiVersion=data.get('apiVersion', None),
                kind=data.get('kind', None),
                selfLink=data.get('selfLink', None),
            )
Exemplo n.º 2
0
    def newFromDict(data):
        if data is None:
            data = {}

        if not isinstance(data, dict):
            raise PyK8SError('Type dict required')
        else:
            return Nodes(
                resourceVersion=data.get('resourceVersion', None),
                creationTimestamp=data.get('creationTimestamp', None),
                items=[
                    Node.newFromDict(item)
                    for item in (data.get('items', {}) if (
                        data.get('items', {}) is not None) else {})
                ],
                apiVersion=data.get('apiVersion', None),
                kind=data.get('kind', None),
                selfLink=data.get('selfLink', None),
            )
Exemplo n.º 3
0
 def addNodeFromFile(self,filename):
     ob=Node.newFromJsonFile(filename)
     return self.postNode(ob.toDict())
Exemplo n.º 4
0
 def getNode(self,name):
     response = self.get('nodes/'+name)
     return Node.newFromDict(response)
Exemplo n.º 5
0
 def addNodeFromFile(self, filename):
     ob = Node.newFromJsonFile(filename)
     return self.postNode(ob.toDict())
Exemplo n.º 6
0
 def getNode(self, name):
     response = self.get('nodes/' + name)
     return Node.newFromDict(response)