Debian Codegraph @

ansible_collections/community/docker/plugins/module_utils/_api/constants.py

raw
1 # This code is part of the Ansible collection community.docker, but is an independent component.
2 # This particular file, and this file only, is based on the Docker SDK for Python (https://github.com/docker/docker-py/)
3 #
4 # Copyright (c) 2016-2022 Docker, Inc.
5 #
6 # It is licensed under the Apache 2.0 license (see LICENSES/Apache-2.0.txt in this collection)
7 # SPDX-License-Identifier: Apache-2.0
8
9 # Note that this module util is **PRIVATE** to the collection. It can have breaking changes at any time.
10 # Do not use this from other collections or standalone plugins/modules!
11
12 from __future__ import annotations
13
14 import sys
15
16 MINIMUM_DOCKER_API_VERSION = "1.21"
17 DEFAULT_TIMEOUT_SECONDS = 60
18 STREAM_HEADER_SIZE_BYTES = 8
19 CONTAINER_LIMITS_KEYS = ["memory", "memswap", "cpushares", "cpusetcpus"]
20
21 DEFAULT_HTTP_HOST = "127.0.0.1"
22 DEFAULT_UNIX_SOCKET = "http+unix:///var/run/docker.sock"
23 DEFAULT_NPIPE = "npipe:////./pipe/docker_engine"
24
25 BYTE_UNITS = {"b": 1, "k": 1024, "m": 1024 * 1024, "g": 1024 * 1024 * 1024}
26
27 IS_WINDOWS_PLATFORM = sys.platform == "win32"
28 WINDOWS_LONGPATH_PREFIX = "\\\\?\\"
29
30 DEFAULT_USER_AGENT = "ansible-community.docker"
31 DEFAULT_NUM_POOLS = 25
32
33 # The OpenSSH server default value for MaxSessions is 10 which means we can
34 # use up to 9, leaving the final session for the underlying SSH connection.
35 # For more details see: https://github.com/docker/docker-py/issues/2246
36 DEFAULT_NUM_POOLS_SSH = 9
37
38 DEFAULT_MAX_POOL_SIZE = 10
39
40 DEFAULT_DATA_CHUNK_SIZE = 1024 * 2048