示例#1
0
文件: pods.py 项目: chixq/pyk8s
    def newFromDict(data):
        if data is None:
            data = {}

        if not isinstance(data, dict):
            raise PyK8SError('Type dict required')
        else:
            return Pods(
                apiVersion=data.get('apiVersion', None),
                resourceVersion=data.get('resourceVersion', None),
                kind=data.get('kind', None),
                items = [Pod.newFromDict(item) for item in (data.get('items',{}) if (data.get('items',{}) is not None) else {})],
                selfLink=data.get('selfLink', None),
                creationTimestamp=data.get('creationTimestamp', None),
            )
示例#2
0
文件: pods.py 项目: teja624/pyk8s
    def newFromDict(data):
        if data is None:
            data = {}

        if not isinstance(data, dict):
            raise PyK8SError('Type dict required')
        else:
            return Pods(
                apiVersion=data.get('apiVersion', None),
                resourceVersion=data.get('resourceVersion', None),
                kind=data.get('kind', None),
                items=[
                    Pod.newFromDict(item)
                    for item in (data.get('items', {}) if (
                        data.get('items', {}) is not None) else {})
                ],
                selfLink=data.get('selfLink', None),
                creationTimestamp=data.get('creationTimestamp', None),
            )
示例#3
0
文件: endpoints.py 项目: chixq/pyk8s
 def getPod(self,name):
     response = self.get('pods/'+name)
     return Pod.newFromDict(response)
示例#4
0
文件: endpoints.py 项目: chixq/pyk8s
 def addPodFromFile(self,filename):
     ob=Pod.newFromJsonFile(filename)
     return self.postPod(ob.toDict())
示例#5
0
 def getPod(self, name):
     response = self.get('pods/' + name)
     return Pod.newFromDict(response)
示例#6
0
 def addPodFromFile(self, filename):
     ob = Pod.newFromJsonFile(filename)
     return self.postPod(ob.toDict())