File: group.py

package info (click to toggle)
python-marathon 0.13.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 460 kB
  • sloc: python: 1,969; makefile: 185; sh: 58
file content (40 lines) | stat: -rw-r--r-- 1,313 bytes parent folder | download | duplicates (3)
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
from .base import MarathonResource
from .app import MarathonApp


class MarathonGroup(MarathonResource):

    """Marathon group resource.

    See: https://mesosphere.github.io/marathon/docs/rest-api.html#groups

    :param apps:
    :type apps: list[:class:`marathon.models.app.MarathonApp`] or list[dict]
    :param list[str] dependencies:
    :param groups:
    :type groups: list[:class:`marathon.models.group.MarathonGroup`] or list[dict]
    :param str id:
    :param pods:
    :type pods: list[:class:`marathon.models.pod.MarathonPod`] or list[dict]
    :param str version:
    """

    def __init__(self, apps=None, dependencies=None,
                 groups=None, id=None, pods=None, version=None):
        self.apps = [
            a if isinstance(a, MarathonApp) else MarathonApp().from_json(a)
            for a in (apps or [])
        ]
        self.dependencies = dependencies or []
        self.groups = [
            g if isinstance(g, MarathonGroup) else MarathonGroup().from_json(g)
            for g in (groups or [])
        ]
        self.pods = []
        # ToDo: Create class MarathonPod
        # self.pods = [
        #     p if isinstance(p, MarathonPod) else MarathonPod().from_json(p)
        #     for p in (pods or [])
        # ]
        self.id = id
        self.version = version