Exemplo n.º 1
0
    def _build_with_model(self, model=None):
        super(Job, self).build_with_model(model)

        if 'spec' in model:
            self.spec = JobSpec(model['spec'])
        if 'status' in model:
            self.status = JobStatus(model['status'])
Exemplo n.º 2
0
    def __init__(self, model=None):
        super(Job, self).__init__()

        self.kind = 'Job'
        self.api_version = 'batch/v1'
        self.spec = JobSpec()
        self.status = JobStatus()

        if model is not None:
            self._build_with_model(model)
Exemplo n.º 3
0
 def _build_with_model(self, model=None):
     if 'kind' in model:
         self.kind = model['kind']
     if 'apiVersion' in model:
         self.api_version = model['apiVersion']
     if 'metadata' in model:
         self.metadata = ObjectMeta(model['metadata'])
     if 'spec' in model:
         self.spec = JobSpec(model['spec'])
     if 'status' in model:
         self.status = JobStatus(model['status'])
Exemplo n.º 4
0
class Job(BaseModel):
    """
    http://kubernetes.io/docs/api-reference/batch/v1/definitions/#_v1_job
    """
    def __init__(self, model=None):
        super(Job, self).__init__()

        self.kind = 'Job'
        self.api_version = 'batch/v1'
        self.spec = JobSpec()
        self.status = JobStatus()

        if model is not None:
            self._build_with_model(model)

    def _build_with_model(self, model=None):
        if 'kind' in model:
            self.kind = model['kind']
        if 'apiVersion' in model:
            self.api_version = model['apiVersion']
        if 'metadata' in model:
            self.metadata = ObjectMeta(model['metadata'])
        if 'spec' in model:
            self.spec = JobSpec(model['spec'])
        if 'status' in model:
            self.status = JobStatus(model['status'])

    # --------------------------------------------------------------------------------- spec

    @property
    def spec(self):
        return self._spec

    @spec.setter
    def spec(self, s=None):
        if not isinstance(s, JobSpec):
            raise SyntaxError('Job: spec: [ {} ] is invalid.'.format(s))
        self._spec = s

    # --------------------------------------------------------------------------------- status

    @property
    def status(self):
        return self._status

    @status.setter
    def status(self, s=None):
        if not isinstance(s, JobStatus):
            raise SyntaxError('Job: status: [ {} ] is invalid.'.format(s))
        self._status = s

    # --------------------------------------------------------------------------------- serialize

    def serialize(self):
        data = super(Job, self).serialize()
        if self.spec is not None:
            data['spec'] = self.spec.serialize()
        if self.status is not None:
            data['status'] = self.status.serialize()
        return data
Exemplo n.º 5
0
    def _build_with_model(self, model=None):
        super(Job, self).build_with_model(model)

        if 'spec' in model:
            self.spec = JobSpec(model['spec'])
        if 'status' in model:
            self.status = JobStatus(model['status'])
Exemplo n.º 6
0
class Job(BaseModel):
    """
    http://kubernetes.io/docs/api-reference/batch/v1/definitions/#_v1_job
    """

    def __init__(self, model=None):
        super(Job, self).__init__()

        self.kind = 'Job'
        self.api_version = 'batch/v1'

        self.spec = JobSpec()
        self.status = JobStatus()

        if model is not None:
            self._build_with_model(model)

    def _build_with_model(self, model=None):
        super(Job, self).build_with_model(model)

        if 'spec' in model:
            self.spec = JobSpec(model['spec'])
        if 'status' in model:
            self.status = JobStatus(model['status'])

    # --------------------------------------------------------------------------------- spec

    @property
    def spec(self):
        return self._spec

    @spec.setter
    def spec(self, s=None):
        if not isinstance(s, JobSpec):
            raise SyntaxError('Job: spec: [ {} ] is invalid.'.format(s))
        self._spec = s

    # --------------------------------------------------------------------------------- status

    @property
    def status(self):
        return self._status

    @status.setter
    def status(self, s=None):
        if not isinstance(s, JobStatus):
            raise SyntaxError('Job: status: [ {} ] is invalid.'.format(s))
        self._status = s

    # --------------------------------------------------------------------------------- serialize

    def serialize(self):
        data = super(Job, self).serialize()

        if self.spec is not None:
            data['spec'] = self.spec.serialize()
        if self.status is not None:
            data['status'] = self.status.serialize()
        return data
Exemplo n.º 7
0
    def __init__(self, model=None):
        super(CronJobTemplate, self).__init__()

        self._metadata = ObjectMeta()
        self._spec = JobSpec()

        if model is not None:
            self._build_with_model(model)
Exemplo n.º 8
0
    def __init__(self, model=None):
        super(Job, self).__init__()

        self.kind = 'Job'
        self.api_version = 'batch/v1'

        self.spec = JobSpec()
        self.status = JobStatus()

        if model is not None:
            self._build_with_model(model)
Exemplo n.º 9
0
class CronJobTemplate(object):
    def __init__(self, model=None):
        super(CronJobTemplate, self).__init__()

        self._metadata = ObjectMeta()
        self._spec = JobSpec()

        if model is not None:
            self._build_with_model(model)

    def _build_with_model(self, model=None):
        if 'metadata' in model:
            self.metadata = ObjectMeta(model['metadata'])
        if 'spec' in model:
            self.spec = JobSpec(model['spec'])

    # ------------------------------------------------------------------------------------- metadata

    @property
    def metadata(self):
        return self._metadata

    @metadata.setter
    def metadata(self, meta=None):
        if not isinstance(meta, ObjectMeta):
            raise SyntaxError(
                'CronJobTemplate: metadata: [ {} ] is invalid.'.format(meta))
        self._metadata = meta

    # ------------------------------------------------------------------------------------- spec

    @property
    def spec(self):
        return self._spec

    @spec.setter
    def spec(self, spec=None):
        if not isinstance(spec, JobSpec):
            raise SyntaxError(
                'CronJobTemplate: spec: [ {} ] is invalid.'.format(spec))
        self._spec = spec

    # ------------------------------------------------------------------------------------- serialize

    def serialize(self):
        data = {}
        if self.metadata is not None:
            data['metadata'] = self.metadata.serialize()
        if self.spec is not None:
            data['spec'] = self.spec.serialize()
        return data
Exemplo n.º 10
0
 def _build_with_model(self, model=None):
     if 'metadata' in model:
         self.metadata = ObjectMeta(model['metadata'])
     if 'spec' in model:
         self.spec = JobSpec(model['spec'])