summaryrefslogtreecommitdiff
path: root/docker/types/swarm.py
diff options
context:
space:
mode:
authorOndřej Nový <onovy@debian.org>2016-10-07 22:56:59 +0200
committerOndřej Nový <onovy@debian.org>2016-10-07 22:56:59 +0200
commit5d8d4569fb7b4e869d9c88fa0f7f703c38f8131e (patch)
treecaa16dd2da7ca381a4cfe7d34bb69b9936422cdc /docker/types/swarm.py
parent49556cb01423a89a6d2ce7a58b1f5cb64dde0ff3 (diff)
Import python-docker_1.10.3.orig.tar.gz
Diffstat (limited to 'docker/types/swarm.py')
-rw-r--r--docker/types/swarm.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/docker/types/swarm.py b/docker/types/swarm.py
new file mode 100644
index 0000000..865fde6
--- /dev/null
+++ b/docker/types/swarm.py
@@ -0,0 +1,40 @@
+class SwarmSpec(dict):
+ def __init__(self, task_history_retention_limit=None,
+ snapshot_interval=None, keep_old_snapshots=None,
+ log_entries_for_slow_followers=None, heartbeat_tick=None,
+ election_tick=None, dispatcher_heartbeat_period=None,
+ node_cert_expiry=None, external_ca=None, name=None):
+ if task_history_retention_limit is not None:
+ self['Orchestration'] = {
+ 'TaskHistoryRetentionLimit': task_history_retention_limit
+ }
+ if any([snapshot_interval, keep_old_snapshots,
+ log_entries_for_slow_followers, heartbeat_tick, election_tick]):
+ self['Raft'] = {
+ 'SnapshotInterval': snapshot_interval,
+ 'KeepOldSnapshots': keep_old_snapshots,
+ 'LogEntriesForSlowFollowers': log_entries_for_slow_followers,
+ 'HeartbeatTick': heartbeat_tick,
+ 'ElectionTick': election_tick
+ }
+
+ if dispatcher_heartbeat_period:
+ self['Dispatcher'] = {
+ 'HeartbeatPeriod': dispatcher_heartbeat_period
+ }
+
+ if node_cert_expiry or external_ca:
+ self['CAConfig'] = {
+ 'NodeCertExpiry': node_cert_expiry,
+ 'ExternalCA': external_ca
+ }
+
+ if name is not None:
+ self['Name'] = name
+
+
+class SwarmExternalCA(dict):
+ def __init__(self, url, protocol=None, options=None):
+ self['URL'] = url
+ self['Protocol'] = protocol
+ self['Options'] = options