diff --git a/marathon/models/info.py b/marathon/models/info.py index 4de911c..fb05d70 100644 --- a/marathon/models/info.py +++ b/marathon/models/info.py @@ -14,10 +14,14 @@ class MarathonInfo(MarathonResource): :param str version: :param zookeeper_config: :type zookeeper_config: :class:`marathon.models.info.MarathonZooKeeperConfig` or dict + :param http_config: + :type http_config: :class:`marathon.models.info.MarathonHttpConfig` or dict + :param event_subscriber: + :type event_subscriber: :class`marathon.models.info.MarathonEventSubscriber` or dict """ def __init__(self, framework_id=None, leader=None, marathon_config=None, name=None, version=None, - zookeeper_config=None): + zookeeper_config=None, http_config=None, event_subscriber=None): self.framework_id = framework_id self.leader = leader self.marathon_config = marathon_config if isinstance(marathon_config, MarathonConfig) \ @@ -26,12 +30,16 @@ def __init__(self, framework_id=None, leader=None, marathon_config=None, name=No self.version = version self.zookeeper_config = zookeeper_config if isinstance(zookeeper_config, MarathonZooKeeperConfig) \ else MarathonZooKeeperConfig().from_json(zookeeper_config) + self.http_config = http_config if isinstance(http_config, MarathonHttpConfig) \ + else MarathonHttpConfig().from_json(http_config) + self.event_subscriber = event_subscriber if isinstance(event_subscriber, MarathonEventSubscriber) \ + else MarathonEventSubscriber().from_json(event_subscriber) class MarathonConfig(MarathonObject): - """Marathon Application resource. + """Marathon config resource. - See: https://mesosphere.github.io/marathon/docs/rest-api.html#deployments + See: https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/info :param bool checkpoint: :param str executor: @@ -67,9 +75,9 @@ def __init__(self, checkpoint=None, executor=None, failover_timeout=None, ha=Non class MarathonZooKeeperConfig(MarathonObject): - """Marathon Application resource. + """Marathon zookeeper config resource. - See: https://mesosphere.github.io/marathon/docs/rest-api.html#deployments + See: https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/info :param str zk: :param dict zk_future_timeout: @@ -85,4 +93,32 @@ def __init__(self, zk=None, zk_future_timeout=None, zk_hosts=None, zk_path=None, self.zk_hosts = zk_hosts self.zk_path = zk_path self.zk_state = zk_state - self.zk_timeout = zk_timeout \ No newline at end of file + self.zk_timeout = zk_timeout + +class MarathonHttpConfig(MarathonObject): + """Marathon http config resource. + + See: https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/info + + :param str assets_path: + :param int http_port: + :param int https_port: + """ + + def __init__(self, assets_path=None, http_port=None, https_port=None): + self.assets_path = assets_path + self.http_port = http_port + self.https_port = https_port + +class MarathonEventSubscriber(MarathonObject): + """Marathon event subscriber resource. + + See: https://mesosphere.github.io/marathon/docs/rest-api.html#get-/v2/info + + :param str type: + :param list[str] http_endpoints: + """ + + def __init__(self, type=None, http_endpoints=None): + self.type = type + self.http_endpoints = http_endpoints diff --git a/marathon/models/task.py b/marathon/models/task.py index c14332a..f73a673 100644 --- a/marathon/models/task.py +++ b/marathon/models/task.py @@ -17,11 +17,12 @@ class MarathonTask(MarathonResource): :param started_at: when this task was started :type started_at: datetime or str :param str version: app version with which this task was started + :param list[int] service_ports: ports exposed for load balancing """ DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ' - def __init__(self, app_id=None, health_check_results=None, host=None, id=None, ports=None, staged_at=None, started_at=None, version=None): + def __init__(self, app_id=None, health_check_results=None, host=None, id=None, ports=None, staged_at=None, started_at=None, version=None, service_ports=None): self.app_id = app_id self.health_check_results = health_check_results or [] self.health_check_results = [ @@ -36,6 +37,7 @@ def __init__(self, app_id=None, health_check_results=None, host=None, id=None, p self.started_at = started_at if (started_at is None or isinstance(started_at, datetime)) \ else datetime.strptime(started_at, self.DATETIME_FORMAT) self.version = version + self.service_ports = service_ports or [] class MarathonHealthCheckResult(MarathonObject):