Class: DockerEngineAPI::Client
- Inherits:
-
Internal::Transport::BaseClient
- Object
- Internal::Transport::BaseClient
- DockerEngineAPI::Client
- Defined in:
- lib/docker_engine_api/client.rb
Constant Summary collapse
- DEFAULT_MAX_RETRIES =
Default max number of retries to attempt after a failed retryable request.
2- DEFAULT_TIMEOUT_IN_SECONDS =
Default per-request timeout.
60.0- DEFAULT_INITIAL_RETRY_DELAY =
Default initial retry delay in seconds. Overall delay is calculated using exponential backoff + jitter.
0.5- DEFAULT_MAX_RETRY_DELAY =
Default max retry delay in seconds.
8.0
Constants inherited from Internal::Transport::BaseClient
Internal::Transport::BaseClient::MAX_REDIRECTS, Internal::Transport::BaseClient::PLATFORM_HEADERS
Instance Attribute Summary collapse
- #auth ⇒ DockerEngineAPI::Resources::Auth readonly
- #configs ⇒ DockerEngineAPI::Resources::Configs readonly
- #containers ⇒ DockerEngineAPI::Resources::Containers readonly
- #distribution ⇒ DockerEngineAPI::Resources::Distribution readonly
- #exec_ ⇒ DockerEngineAPI::Resources::Exec readonly
- #images ⇒ DockerEngineAPI::Resources::Images readonly
- #networks ⇒ DockerEngineAPI::Resources::Networks readonly
- #nodes ⇒ DockerEngineAPI::Resources::Nodes readonly
- #plugins ⇒ DockerEngineAPI::Resources::Plugins readonly
- #secrets ⇒ DockerEngineAPI::Resources::Secrets readonly
- #services ⇒ DockerEngineAPI::Resources::Services readonly
- #swarm ⇒ DockerEngineAPI::Resources::Swarm readonly
- #system_ ⇒ DockerEngineAPI::Resources::System readonly
- #tasks ⇒ DockerEngineAPI::Resources::Tasks readonly
- #volumes ⇒ DockerEngineAPI::Resources::Volumes readonly
Attributes inherited from Internal::Transport::BaseClient
#base_url, #headers, #idempotency_header, #initial_retry_delay, #max_retries, #max_retry_delay, #requester, #timeout
Instance Method Summary collapse
-
#initialize(base_url: ENV["DOCKER_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY) ⇒ Client
constructor
Creates and returns a new client for interacting with the API.
Methods inherited from Internal::Transport::BaseClient
follow_redirect, #inspect, reap_connection!, #request, #send_request, should_retry?, validate!
Methods included from Internal::Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(base_url: ENV["DOCKER_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY) ⇒ Client
Creates and returns a new client for interacting with the API.
"https://api.example.com/v2/". Defaults to ENV["DOCKER_BASE_URL"]
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/docker_engine_api/client.rb', line 75 def initialize( base_url: ENV["DOCKER_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY ) base_url ||= "http://localhost:2375" super( base_url: base_url, timeout: timeout, max_retries: max_retries, initial_retry_delay: initial_retry_delay, max_retry_delay: max_retry_delay ) @auth = DockerEngineAPI::Resources::Auth.new(client: self) @system_ = DockerEngineAPI::Resources::System.new(client: self) @containers = DockerEngineAPI::Resources::Containers.new(client: self) @exec_ = DockerEngineAPI::Resources::Exec.new(client: self) @images = DockerEngineAPI::Resources::Images.new(client: self) @networks = DockerEngineAPI::Resources::Networks.new(client: self) @volumes = DockerEngineAPI::Resources::Volumes.new(client: self) @services = DockerEngineAPI::Resources::Services.new(client: self) @configs = DockerEngineAPI::Resources::Configs.new(client: self) @secrets = DockerEngineAPI::Resources::Secrets.new(client: self) @nodes = DockerEngineAPI::Resources::Nodes.new(client: self) @swarm = DockerEngineAPI::Resources::Swarm.new(client: self) @tasks = DockerEngineAPI::Resources::Tasks.new(client: self) @plugins = DockerEngineAPI::Resources::Plugins.new(client: self) @distribution = DockerEngineAPI::Resources::Distribution.new(client: self) end |
Instance Attribute Details
#auth ⇒ DockerEngineAPI::Resources::Auth (readonly)
19 20 21 |
# File 'lib/docker_engine_api/client.rb', line 19 def auth @auth end |
#configs ⇒ DockerEngineAPI::Resources::Configs (readonly)
43 44 45 |
# File 'lib/docker_engine_api/client.rb', line 43 def configs @configs end |
#containers ⇒ DockerEngineAPI::Resources::Containers (readonly)
25 26 27 |
# File 'lib/docker_engine_api/client.rb', line 25 def containers @containers end |
#distribution ⇒ DockerEngineAPI::Resources::Distribution (readonly)
61 62 63 |
# File 'lib/docker_engine_api/client.rb', line 61 def distribution @distribution end |
#exec_ ⇒ DockerEngineAPI::Resources::Exec (readonly)
28 29 30 |
# File 'lib/docker_engine_api/client.rb', line 28 def exec_ @exec_ end |
#images ⇒ DockerEngineAPI::Resources::Images (readonly)
31 32 33 |
# File 'lib/docker_engine_api/client.rb', line 31 def images @images end |
#networks ⇒ DockerEngineAPI::Resources::Networks (readonly)
34 35 36 |
# File 'lib/docker_engine_api/client.rb', line 34 def networks @networks end |
#nodes ⇒ DockerEngineAPI::Resources::Nodes (readonly)
49 50 51 |
# File 'lib/docker_engine_api/client.rb', line 49 def nodes @nodes end |
#plugins ⇒ DockerEngineAPI::Resources::Plugins (readonly)
58 59 60 |
# File 'lib/docker_engine_api/client.rb', line 58 def plugins @plugins end |
#secrets ⇒ DockerEngineAPI::Resources::Secrets (readonly)
46 47 48 |
# File 'lib/docker_engine_api/client.rb', line 46 def secrets @secrets end |
#services ⇒ DockerEngineAPI::Resources::Services (readonly)
40 41 42 |
# File 'lib/docker_engine_api/client.rb', line 40 def services @services end |
#swarm ⇒ DockerEngineAPI::Resources::Swarm (readonly)
52 53 54 |
# File 'lib/docker_engine_api/client.rb', line 52 def swarm @swarm end |
#system_ ⇒ DockerEngineAPI::Resources::System (readonly)
22 23 24 |
# File 'lib/docker_engine_api/client.rb', line 22 def system_ @system_ end |
#tasks ⇒ DockerEngineAPI::Resources::Tasks (readonly)
55 56 57 |
# File 'lib/docker_engine_api/client.rb', line 55 def tasks @tasks end |
#volumes ⇒ DockerEngineAPI::Resources::Volumes (readonly)
37 38 39 |
# File 'lib/docker_engine_api/client.rb', line 37 def volumes @volumes end |